本文整理汇总了PHP中Propal::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Propal::fetch方法的具体用法?PHP Propal::fetch怎么用?PHP Propal::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propal
的用法示例。
在下文中一共展示了Propal::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Propal
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new Propal($db);
/*
* Actions
*/
// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref);
if (create_exdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
$langs->load("errors");
示例2: Propal
}
else
{
$reload = 0;
$action='';
}
}
/*
* Ajout du produit dans une propal
*/
if ($action == 'addinpropal')
{
$propal = new Propal($db);
$result=$propal->fetch($_POST["propalid"]);
if ($result <= 0)
{
dol_print_error($db,$propal->error);
exit;
}
$soc = new Societe($db);
$result=$soc->fetch($propal->socid);
if ($result <= 0)
{
dol_print_error($db,$soc->error);
exit;
}
$prod = new Product($db);
示例3: GETPOST
$langs->load("companies");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$action = GETPOST('action', 'alpha');
// Security check
if ($user->societe_id) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'propale', $id, 'propal');
$object = new Propal($db);
/*
* Ajout d'un nouveau contact
*/
if ($action == 'addcontact' && $user->rights->propale->creer) {
$result = $object->fetch($id);
if ($result > 0 && $id > 0) {
$contactid = GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int');
$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>';
}
}
示例4: Form
/******************************************************************************/
/* Actions */
/******************************************************************************/
if ($_GET["action"] == 'setstatut')
{
// Close proposal
$object->id = $_GET["id"];
$object->cloture($user, $_GET["statut"], $note);
}
// Set project
if ($_POST['action'] == 'classin')
{
$object->fetch($_GET["id"]);
$object->setProject($_POST['projectid']);
}
/*
* View
*/
$now=gmmktime();
llxHeader();
$html = new Form($db);
$htmlother = new FormOther($db);
示例5: header
}
if ($result > 0) {
header('Location: ' . DOL_URL_ROOT . '/product/list.php?type=' . $object->type . '&delprod=' . urlencode($object->ref));
exit;
} else {
setEventMessages($langs->trans($object->error), null, 'errors');
$reload = 0;
$action = '';
}
}
// Add product into object
if ($object->id > 0 && $action == 'addin') {
$thirpdartyid = 0;
if (GETPOST('propalid') > 0) {
$propal = new Propal($db);
$result = $propal->fetch(GETPOST('propalid'));
if ($result <= 0) {
dol_print_error($db, $propal->error);
exit;
}
$thirpdartyid = $propal->socid;
} elseif (GETPOST('commandeid') > 0) {
$commande = new Commande($db);
$result = $commande->fetch(GETPOST('commandeid'));
if ($result <= 0) {
dol_print_error($db, $commande->error);
exit;
}
$thirpdartyid = $commande->socid;
} elseif (GETPOST('factureid') > 0) {
$facture = new Facture($db);
示例6: GETPOST
// Security check
$socid = 0;
$id = GETPOST('id', 'int');
$ref = GETPOST("ref");
if ($user->societe_id) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'propal', $id);
/*
* View Mode
*/
$form = new Form($db);
llxHeader();
if ($id > 0 || !empty($ref)) {
$object = new Propal($db);
if ($object->fetch($id, $ref) > 0) {
$soc = new Societe($db);
$soc->fetch($object->socid);
$head = propal_prepare_head($object);
dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal');
/*
* Propal
*/
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (!empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Ref client
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
示例7: createFromClone
/**
* Load an object from its id and create a new one in database
* @param fromid Id of object to clone
* @param invertdetail Reverse sign of amounts for lines
* @param socid Id of thirdparty
* @return int New id of clone
*/
function createFromClone($fromid, $invertdetail = 0, $socid = 0)
{
global $user, $langs, $conf;
$error = 0;
$now = dol_now();
$object = new Propal($this->db);
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) {
$object->callHooks('propalcard');
}
$this->db->begin();
// Load source object
$object->fetch($fromid);
$objFrom = $object;
$objsoc = new Societe($this->db);
// Change socid if needed
if (!empty($socid) && $socid != $object->socid) {
if ($objsoc->fetch($socid) > 0) {
$object->socid = $objsoc->id;
$object->cond_reglement_id = !empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0;
$object->mode_reglement_id = !empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0;
$object->fk_project = '';
$object->fk_delivery_address = '';
}
// TODO Change product price if multi-prices
} else {
$objsoc->fetch($object->socid);
}
$object->id = 0;
$object->statut = 0;
$objsoc->fetch($object->socid);
if (empty($conf->global->PROPALE_ADDON) || !is_readable(DOL_DOCUMENT_ROOT . "/includes/modules/propale/" . $conf->global->PROPALE_ADDON . ".php")) {
$this->error = 'ErrorSetupNotComplete';
return -1;
}
// Clear fields
$object->user_author = $user->id;
$object->user_valid = '';
$object->date = '';
$object->datep = $now;
$object->fin_validite = $object->datep + $this->duree_validite * 24 * 3600;
$object->ref_client = '';
// Set ref
require_once DOL_DOCUMENT_ROOT . "/includes/modules/propale/" . $conf->global->PROPALE_ADDON . ".php";
$obj = $conf->global->PROPALE_ADDON;
$modPropale = new $obj();
$object->ref = $modPropale->getNextValue($objsoc, $object);
// Create clone
$result = $object->create($user);
// Other options
if ($result < 0) {
$this->error = $object->error;
$error++;
}
if (!$error) {
// Hook for external modules
if (!empty($object->hooks)) {
foreach ($object->hooks as $hook) {
if (!empty($hook['modules'])) {
foreach ($hook['modules'] as $module) {
if (method_exists($module, 'createfrom')) {
$result = $module->createfrom($objFrom, $result, $object->element);
if ($result < 0) {
$error++;
}
}
}
}
}
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
$interface = new Interfaces($this->db);
$result = $interface->run_triggers('PROPAL_CLONE', $object, $user, $langs, $conf);
if ($result < 0) {
$error++;
$this->errors = $interface->errors;
}
// Fin appel triggers
}
// End
if (!$error) {
$this->db->commit();
return $object->id;
} else {
$this->db->rollback();
return -1;
}
}
示例8: Propal
if ($absolute_creditnote)
{
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id)
{
// Si source = propal
$propal = new Propal($db);
$propal->fetch($commande->propale_id);
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$propal->id.'">'.$propal->ref.'</a>';
}
print '</td>';
print '</tr>';
// Delivery date planned
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateDeliveryPlanned');
print '</td>';
if ($_GET['action'] != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editdate_livraison')
示例9: isset
$id = isset($_GET["id"])?$_GET["id"]:'';
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal');
/*
* View
*/
llxHeader();
$propal = new Propal($db);
$propal->fetch($_GET["id"]);
$societe = new Societe($db);
$societe->fetch($propal->socid);
$head = propal_prepare_head($propal);
dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal');
$propal->info($propal->id);
print '<table width="100%"><tr><td>';
dol_print_object_info($propal);
print '</td></tr></table>';
print '</div>';
示例10: TPDOdb
}
} else {
if ($type_tag == 'rel') {
$res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "twiiit WHERE comment LIKE '%:" . $db->escape($tag) . "%'");
$PDOdb = new TPDOdb();
while ($obj = $db->fetch_object($res)) {
$twiiit = new TTwiiit();
$twiiit->load($PDOdb, $obj->rowid);
$Tab[] = array('link' => $twiiit->getNomUrl(), 'text' => $twiiit->getComment());
}
} else {
if ($type_tag == 'hashtag') {
$res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "propal WHERE ref = '" . $db->escape($tag) . "'");
while ($obj = $db->fetch_object($res)) {
$o = new Propal($db);
$o->fetch($obj->rowid);
$Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'user');
}
$res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "facture WHERE facnumber = '" . $db->escape($tag) . "'");
while ($obj = $db->fetch_object($res)) {
$o = new Facture($db);
$o->fetch($obj->rowid);
$Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe');
}
$res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "product WHERE ref = '" . $db->escape($tag) . "'");
while ($obj = $db->fetch_object($res)) {
$o = new Product($db);
$o->fetch($obj->rowid);
$Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe');
}
} else {
示例11: _task_propal
function _task_propal(&$db, $fk_propal)
{
global $conf, $langs, $user;
if (empty($conf->nomenclature->enabled)) {
return array();
}
$PDOdb = new TPDOdb();
dol_include_once('/comm/propal/class/propal.class.php');
dol_include_once('/nomenclature/class/nomenclature.class.php');
$o = new Propal($db);
$o->fetch($fk_propal);
$TTask = _task_from_line_object($PDOdb, $o->lines, 'propal');
return $TTask;
}
示例12: ON
$sql = 'SELECT p.rowid FROM ' . MAIN_DB_PREFIX . 'propal p
INNER JOIN ' . MAIN_DB_PREFIX . 'propal_extrafields pe ON (p.rowid = pe.fk_object)
WHERE p.entity = ' . $conf->entity . '
AND p.fk_statut = 1
AND pe.date_relance = "' . $db->escape($today) . '"';
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
$msgishtml = $conf->fckeditor->enabled && !empty($conf->global->FCKEDITOR_ENABLE_MAIL) ? 1 : 0;
while ($line = $db->fetch_object($resql)) {
$subject = $conf->global->PROPALAUTOSEND_MSG_SUBJECT;
if (empty($subject)) {
exit("errorSubjectMailIsEmpty");
}
$contactFound = false;
$propal = new Propal($db);
$propal->fetch($line->rowid);
$propal->fetch_thirdparty();
$TSearchPropal = array('__PROPAL_ref', '__PROPAL_ref_client', '__PROPAL_total_ht', '__PROPAL_total_tva', '__PROPAL_total_ttc', '__PROPAL_datep', '__PROPAL_fin_validite');
$TValPropal = array($propal->ref, $propal->ref_client, $propal->total_ht, $propal->total_tva, $propal->total_ttc, dol_print_date($propal->datep, '%d/%m/%Y'), dol_print_date($propal->fin_validite, '%d/%m/%Y'));
foreach ($TSearchPropal as $i => $propal_value) {
$subject = preg_replace('/' . $propal_value . '\\b/', $TValPropal[$i], $subject);
}
if ($propal->user_author_id > 0) {
$newUser = new User($db);
$newUser->fetch($propal->user_author_id);
} else {
$newUser =& $user;
}
$filename_list = array();
$mimetype_list = array();
$mimefilename_list = array();
示例13: Commande
if ($typeobject == 'commande' && $object->$typeobject->id && $conf->commande->enabled)
{
print '<tr><td>';
$objectsrc=new Commande($db);
$objectsrc->fetch($object->$typeobject->id);
print $langs->trans("RefOrder").'</td>';
print '<td colspan="3">';
print $objectsrc->getNomUrl(1,'commande');
print "</td>\n";
print '</tr>';
}
if ($typeobject == 'propal' && $object->$typeobject->id && $conf->propal->enabled)
{
print '<tr><td>';
$objectsrc=new Propal($db);
$objectsrc->fetch($object->$typeobject->id);
print $langs->trans("RefProposal").'</td>';
print '<td colspan="3">';
print $objectsrc->getNomUrl(1,'expedition');
print "</td>\n";
print '</tr>';
}
// Ref customer
print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
print '<td colspan="3">'.$object->ref_customer."</a></td>\n";
print '</tr>';
// Date creation
print '<tr><td>'.$langs->trans("DateCreation").'</td>';
print '<td colspan="3">'.dol_print_date($object->date_creation,"daytext")."</td>\n";
示例14: create
/**
* Create order
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
*
* @param User $user Objet user that make creation
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger = 0)
{
global $conf, $langs, $mysoc, $hookmanager;
$error = 0;
// Clean parameters
$this->brouillon = 1;
// set command as draft
dol_syslog(get_class($this) . "::create user=" . $user->id);
// Check parameters
if (!empty($this->ref)) {
$result = self::isExistingObject($this->element, 0, $this->ref);
// Check ref is not yet used
if ($result > 0) {
$this->error = 'ErrorRefAlreadyExists';
dol_syslog(get_class($this) . "::create " . $this->error, LOG_WARNING);
$this->db->rollback();
return -1;
}
}
$soc = new Societe($this->db);
$result = $soc->fetch($this->socid);
if ($result < 0) {
$this->error = "Failed to fetch company";
dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
return -2;
}
if (!empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->trans("Source"));
dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
return -1;
}
// $date_commande is deprecated
$date = $this->date_commande ? $this->date_commande : $this->date;
$now = dol_now();
$this->db->begin();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "commande (";
$sql .= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
$sql .= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql .= ", fk_shipping_method";
$sql .= ", fk_warehouse";
$sql .= ", remise_absolue, remise_percent";
$sql .= ", fk_incoterms, location_incoterms";
$sql .= ", entity";
$sql .= ")";
$sql .= " VALUES ('(PROV)'," . $this->socid . ", '" . $this->db->idate($now) . "', " . $user->id;
$sql .= ", " . ($this->fk_project > 0 ? $this->fk_project : "null");
$sql .= ", '" . $this->db->idate($date) . "'";
$sql .= ", " . ($this->source >= 0 && $this->source != '' ? $this->db->escape($this->source) : 'null');
$sql .= ", '" . $this->db->escape($this->note_private) . "'";
$sql .= ", '" . $this->db->escape($this->note_public) . "'";
$sql .= ", " . ($this->ref_ext ? "'" . $this->db->escape($this->ref_ext) . "'" : "null");
$sql .= ", " . ($this->ref_client ? "'" . $this->db->escape($this->ref_client) . "'" : "null");
$sql .= ", " . ($this->ref_int ? "'" . $this->db->escape($this->ref_int) . "'" : "null");
$sql .= ", '" . $this->db->escape($this->modelpdf) . "'";
$sql .= ", " . ($this->cond_reglement_id > 0 ? "'" . $this->cond_reglement_id . "'" : "null");
$sql .= ", " . ($this->mode_reglement_id > 0 ? "'" . $this->mode_reglement_id . "'" : "null");
$sql .= ", " . ($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", " . ($this->availability_id > 0 ? "'" . $this->availability_id . "'" : "null");
$sql .= ", " . ($this->demand_reason_id > 0 ? "'" . $this->demand_reason_id . "'" : "null");
$sql .= ", " . ($this->date_livraison ? "'" . $this->db->idate($this->date_livraison) . "'" : "null");
$sql .= ", " . ($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL');
$sql .= ", " . ($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
$sql .= ", " . ($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL');
$sql .= ", " . ($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
$sql .= ", " . ($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
$sql .= ", " . (int) $this->fk_incoterms;
$sql .= ", '" . $this->db->escape($this->location_incoterms) . "'";
$sql .= ", " . $conf->entity;
$sql .= ")";
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'commande');
if ($this->id) {
$fk_parent_line = 0;
$num = count($this->lines);
/*
* Insert products details into db
*/
for ($i = 0; $i < $num; $i++) {
// Reset fk_parent_line for no child products and special product
if ($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line) || $this->lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
$result = $this->addline($this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, $this->lines[$i]->tva_tx, $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, $this->lines[$i]->remise_percent, $this->lines[$i]->info_bits, $this->lines[$i]->fk_remise_except, 'HT', 0, $this->lines[$i]->date_start, $this->lines[$i]->date_end, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, $this->lines[$i]->array_options, $this->lines[$i]->fk_unit, $this->element, $this->lines[$i]->id);
if ($result < 0) {
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) {
$this->error = $this->db->lasterror();
dol_print_error($this->db);
}
$this->db->rollback();
return -1;
//.........这里部分代码省略.........
示例15: show_actions_done
/**
* Show html area with actions done
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
* TODO change function to be able to list event linked to an object.
*/
function show_actions_done($conf, $langs, $db, $object, $objcon = '', $noprint = 0)
{
global $bc, $user, $conf;
// Check parameters
if (!is_object($object)) {
dol_print_error('', 'BadParameter');
}
$out = '';
$histo = array();
$numaction = 0;
$now = dol_now('tzuser');
if (!empty($conf->agenda->enabled)) {
// Recherche histo sur actioncomm
$sql = "SELECT a.id, a.label,";
$sql .= " a.datep as dp,";
$sql .= " a.datep2 as dp2,";
$sql .= " a.note, a.percent,";
$sql .= " a.fk_element, a.elementtype,";
$sql .= " a.fk_user_author, a.fk_contact,";
$sql .= " c.code as acode, c.libelle,";
$sql .= " u.login, u.rowid as user_id";
if (get_class($object) == 'Societe') {
$sql .= ", sp.lastname, sp.firstname";
}
if (get_class($object) == 'Adherent') {
$sql .= ", m.lastname, m.firstname";
}
$sql .= " FROM " . MAIN_DB_PREFIX . "user as u, " . MAIN_DB_PREFIX . "actioncomm as a";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_actioncomm as c ON a.fk_action = c.id";
if (get_class($object) == 'Societe') {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid";
}
if (get_class($object) == 'Adherent') {
$sql .= ", " . MAIN_DB_PREFIX . "adherent as m";
}
$sql .= " WHERE u.rowid = a.fk_user_author";
$sql .= " AND a.entity IN (" . getEntity('agenda', 1) . ")";
if (get_class($object) == 'Societe' && $object->id) {
$sql .= " AND a.fk_soc = " . $object->id;
}
if (get_class($object) == 'Adherent') {
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
}
if (get_class($object) == 'Adherent' && $object->id) {
$sql .= " AND a.fk_element = " . $object->id;
}
if (is_object($objcon) && $objcon->id) {
$sql .= " AND a.fk_contact = " . $objcon->id;
}
$sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '" . $db->idate($now) . "'))";
$sql .= " ORDER BY a.datep DESC, a.id DESC";
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
$var = true;
while ($i < $num) {
$obj = $db->fetch_object($resql);
$histo[$numaction] = array('type' => 'action', 'id' => $obj->id, 'datestart' => $db->jdate($obj->dp), 'dateend' => $db->jdate($obj->dp2), 'note' => $obj->label, 'percent' => $obj->percent, 'acode' => $obj->acode, 'libelle' => $obj->libelle, 'userid' => $obj->user_id, 'login' => $obj->login, 'contact_id' => $obj->fk_contact, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'fk_element' => $obj->fk_element, 'elementtype' => $obj->elementtype);
$numaction++;
$i++;
}
} else {
dol_print_error($db);
}
}
if (!empty($conf->mailing->enabled) && !empty($objcon->email)) {
$langs->load("mails");
// Recherche histo sur mailing
$sql = "SELECT m.rowid as id, mc.date_envoi as da, m.titre as note, '100' as percentage,";
$sql .= " 'AC_EMAILING' as acode,";
$sql .= " u.rowid as user_id, u.login";
// User that valid action
$sql .= " FROM " . MAIN_DB_PREFIX . "mailing as m, " . MAIN_DB_PREFIX . "mailing_cibles as mc, " . MAIN_DB_PREFIX . "user as u";
$sql .= " WHERE mc.email = '" . $db->escape($objcon->email) . "'";
// Search is done on email.
$sql .= " AND mc.statut = 1";
$sql .= " AND u.rowid = m.fk_user_valid";
$sql .= " AND mc.fk_mailing=m.rowid";
$sql .= " ORDER BY mc.date_envoi DESC, m.rowid DESC";
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
$var = true;
while ($i < $num) {
//.........这里部分代码省略.........