本文整理汇总了PHP中dol_syslog函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_syslog函数的具体用法?PHP dol_syslog怎么用?PHP dol_syslog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_syslog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeAccessToken
/**
* {@inheritDoc}
*/
public function storeAccessToken($service, TokenInterface $token)
{
//var_dump("storeAccessToken");
//var_dump($token);
dol_syslog("storeAccessToken");
$serializedToken = serialize($token);
$this->tokens[$service] = $token;
if (!is_array($this->tokens)) {
$this->tokens = array();
}
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "oauth_token";
$sql .= " WHERE service='" . $service . "' AND entity=1";
$resql = $this->db->query($sql);
if (!$resql) {
dol_print_error($this->db);
}
$obj = $this->db->fetch_array($resql);
if ($obj) {
// update
$sql = "UPDATE " . MAIN_DB_PREFIX . "oauth_token";
$sql .= " SET token='" . $this->db->escape($serializedToken) . "'";
$sql .= " WHERE rowid='" . $obj['rowid'] . "'";
$resql = $this->db->query($sql);
} else {
// save
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "oauth_token (service, token, entity)";
$sql .= " VALUES ('" . $service . "', '" . $this->db->escape($serializedToken) . "', 1)";
$resql = $this->db->query($sql);
}
//print $sql;
// allow chaining
return $this;
}
示例2: select_methodes_commande
/**
* Return list of way to order
*
* @param string $selected Id of preselected input method
* @param string $htmlname Name of HTML select list
* @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @return array Tableau des sources de commandes
*/
function select_methodes_commande($selected = '', $htmlname = 'source_id', $addempty = 0)
{
global $conf, $langs;
$listemethodes = array();
require_once DOL_DOCUMENT_ROOT . "/core/class/html.form.class.php";
$form = new Form($this->db);
$sql = "SELECT rowid, code, libelle as label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_input_method";
$sql .= " WHERE active = 1";
dol_syslog(get_class($this) . "::select_methodes_commande sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$num = $this->db->num_rows($resql);
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$listemethodes[$obj->rowid] = $langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : $obj->label;
$i++;
}
} else {
dol_print_error($this->db);
return -1;
}
print $form->selectarray($htmlname, $listemethodes, $selected, $addempty);
return 1;
}
示例3: create
/**
* Insert accountancy system name into database
*
* @param User $user making insert
* @return int if KO, Id of line if OK
*/
function create($user)
{
$now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " (date_creation, fk_user_author, numero, label)";
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
if ($id > 0) {
$this->rowid = $id;
$result = $this->rowid;
} else {
$result = -2;
$this->error = "AccountancySystem::Create Erreur {$result}";
dol_syslog($this->error, LOG_ERR);
}
} else {
$result = -1;
$this->error = "AccountancySystem::Create Erreur {$result}";
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
示例4: liste_modeles
/**
* Charge en memoire et renvoie la liste des modeles actifs
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db, $maxfilenamelength = 0)
{
dol_syslog(get_class($this) . "::liste_modeles");
$dir = DOL_DOCUMENT_ROOT . "/core/modules/import/";
$handle = opendir($dir);
// Recherche des fichiers drivers imports disponibles
$var = True;
$i = 0;
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (preg_match("/^import_(.*)\\.modules\\.php/i", $file, $reg)) {
$moduleid = $reg[1];
// Loading Class
$file = $dir . "/import_" . $moduleid . ".modules.php";
$classname = "Import" . ucfirst($moduleid);
require_once $file;
$module = new $classname($db, '');
// Picto
$this->picto[$module->id] = $module->picto;
// Driver properties
$this->_driverlabel[$module->id] = $module->getDriverLabel('');
$this->_driverdesc[$module->id] = $module->getDriverDesc('');
$this->_driverversion[$module->id] = $module->getDriverVersion('');
// If use an external lib
$this->_liblabel[$module->id] = $module->getLibLabel('');
$this->_libversion[$module->id] = $module->getLibVersion('');
$i++;
}
}
}
return array_keys($this->_driverlabel);
}
示例5: liste_modeles
/**
* Load into memory list of available export format
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates (same content than array this->driverlabel)
*/
function liste_modeles($db, $maxfilenamelength = 0)
{
dol_syslog(get_class($this) . "::liste_modeles");
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
$handle = opendir($dir);
// Recherche des fichiers drivers exports disponibles
$var = True;
$i = 0;
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (preg_match("/^export_(.*)\\.modules\\.php\$/i", $file, $reg)) {
$moduleid = $reg[1];
// Chargement de la classe
$file = $dir . "/export_" . $moduleid . ".modules.php";
$classname = "Export" . ucfirst($moduleid);
require_once $file;
$module = new $classname($db);
// Picto
$this->picto[$module->id] = $module->picto;
// Driver properties
$this->driverlabel[$module->id] = $module->getDriverLabel() . (empty($module->disabled) ? '' : ' __(Disabled)__');
// '__(Disabled)__' is a key
$this->driverdesc[$module->id] = $module->getDriverDesc();
$this->driverversion[$module->id] = $module->getDriverVersion();
// If use an external lib
$this->liblabel[$module->id] = $module->getLibLabel();
$this->libversion[$module->id] = $module->getLibVersion();
$i++;
}
}
closedir($handle);
}
asort($this->driverlabel);
return $this->driverlabel;
}
示例6: getLabelOfUnit
/**
* Returns the text label from units dictionnary
*
* @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok
*/
public function getLabelOfUnit($type = 'long')
{
global $langs;
if (!$this->fk_unit) {
return '';
}
$langs->load('products');
$this->db->begin();
$label_type = 'label';
if ($type == 'short') {
$label_type = 'short_label';
}
$sql = 'select ' . $label_type . ' from ' . MAIN_DB_PREFIX . 'c_units where rowid=' . $this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$label = $res[$label_type];
$this->db->free($resql);
return $label;
} else {
$this->error = $this->db->error() . ' sql=' . $sql;
dol_syslog(get_class($this) . "::getLabelOfUnit Error " . $this->error, LOG_ERR);
return -1;
}
}
示例7: check_user_password_dolibarr
/**
* Check validity of user/password/entity
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
*
* @param string $usertotest Login
* @param string $passwordtotest Password
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
* @return string Login if OK, '' if KO
*/
function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotest = 1)
{
global $db, $conf, $langs;
global $mc;
dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=" . $usertotest);
$login = '';
if (!empty($usertotest)) {
try {
$host = substr($conf->couchdb->host, 7);
$client = new couchClient('http://' . $usertotest . ':' . $passwordtotest . '@' . $host . ':' . $conf->couchdb->port . '/', $conf->couchdb->name, array("cookie_auth" => TRUE));
$_SESSION['couchdb'] = $client->getSessionCookie();
} catch (Exception $e) {
print $e->getMessage();
exit;
}
if (strlen($_SESSION['couchdb']) < 15) {
sleep(1);
$langs->load('main');
$langs->load('errors');
$_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
} else {
$login = $usertotest;
}
}
return $login;
}
示例8: fetch
/**
* Recupere l'objet prelevement
*
* @param int $rowid id de la facture a recuperer
* @return void|int
*/
function fetch($rowid)
{
global $conf;
$result = 0;
$sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid";
$sql .= ", pl.statut, pl.fk_soc";
$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_lignes as pl";
$sql .= ", " . MAIN_DB_PREFIX . "prelevement_bons as p";
$sql .= " WHERE pl.rowid=" . $rowid;
$sql .= " AND p.rowid = pl.fk_prelevement_bons";
$sql .= " AND p.entity = " . $conf->entity;
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->amount = $obj->amount;
$this->socid = $obj->fk_soc;
$this->statut = $obj->statut;
$this->bon_ref = $obj->ref;
$this->bon_rowid = $obj->bon_rowid;
} else {
$result++;
dol_syslog("LignePrelevement::Fetch rowid={$rowid} numrows=0");
}
$this->db->free($resql);
} else {
$result++;
dol_syslog("LignePrelevement::Fetch rowid={$rowid}");
dol_syslog($this->db->error());
}
return $result;
}
示例9: selectProposalStatus
/**
* Return combo list of differents status of a proposal
* Values are id of table c_propalst
*
* @param string $selected Preselected value
* @param int $short Use short labels
* @param int $excludedraft 0=All status, 1=Exclude draft status
* @param int $showempty 1=Add empty line
* @param string $mode 'customer', 'supplier'
* @return void
*/
function selectProposalStatus($selected = '', $short = 0, $excludedraft = 0, $showempty = 1, $mode = 'customer')
{
global $langs;
$prefix = '';
$listofstatus = array();
if ($mode == 'supplier') {
$prefix = 'SupplierProposalStatus';
$langs->load("supplier_proposal");
$listofstatus = array(0 => array('code' => 'PR_DRAFT'), 1 => array('code' => 'PR_OPEN'), 2 => array('code' => 'PR_SIGNED'), 3 => array('code' => 'PR_NOTSIGNED'), 4 => array('code' => 'PR_CLOSED'));
} else {
$prefix = "PropalStatus";
$sql = "SELECT id, code, label, active FROM " . MAIN_DB_PREFIX . "c_propalst";
$sql .= " WHERE active = 1";
dol_syslog(get_class($this) . "::selectProposalStatus", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$listofstatus[$obj->id] = array('id' => $obj->id, 'code' => $obj->code, 'label' => $obj->label);
$i++;
}
}
} else {
dol_print_error($this->db);
}
}
print '<select class="flat" name="propal_statut">';
if ($showempty) {
print '<option value=""> </option>';
}
foreach ($listofstatus as $key => $obj) {
if ($excludedraft) {
if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') {
$i++;
continue;
}
}
if ($selected == $obj['id']) {
print '<option value="' . $obj['id'] . '" selected>';
} else {
print '<option value="' . $obj['id'] . '">';
}
$key = $obj['code'];
if ($langs->trans($prefix . "PropalStatus" . $key . ($short ? 'Short' : '')) != $prefix . "PropalStatus" . $key . ($short ? 'Short' : '')) {
print $langs->trans($prefix . "PropalStatus" . $key . ($short ? 'Short' : ''));
} else {
$conv_to_new_code = array('PR_DRAFT' => 'Draft', 'PR_OPEN' => 'Opened', 'PR_CLOSED' => 'Closed', 'PR_SIGNED' => 'Signed', 'PR_NOTSIGNED' => 'NotSigned', 'PR_FAC' => 'Billed');
if (!empty($conv_to_new_code[$obj['code']])) {
$key = $conv_to_new_code[$obj['code']];
}
print $langs->trans($prefix . $key . ($short ? 'Short' : '')) != $prefix . $key . ($short ? 'Short' : '') ? $langs->trans($prefix . $key . ($short ? 'Short' : '')) : $obj['label'];
}
print '</option>';
$i++;
}
print '</select>';
}
示例10: DolEditor
/**
* Create an object to build an HTML area to edit a large string content
*
* @param string $htmlname HTML name of WYSIWIG field
* @param string $content Content of WYSIWIG field
* @param int $width Width in pixel of edit area (auto by default)
* @param int $height Height in pixel of edit area (200px by default)
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes', 'dolibarr_details', 'dolibarr_mailings')
* @param string $toolbarlocation Where bar is stored :
* 'In' each window has its own toolbar
* 'Out:name' share toolbar into the div called 'name'
* @param boolean $toolbarstartexpanded Bar is visible or not at start
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
* @param int $okforextendededitor True=Allow usage of extended editor tool (like fckeditor)
* @param int $rows Size of rows for textarea tool
* @param int $cols Size of cols for textarea tool
*/
function DolEditor($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0)
{
global $conf, $langs;
dol_syslog(get_class($this) . "::DolEditor htmlname=" . $htmlname . " toolbarname=" . $toolbarname);
if (!$rows) {
$rows = round($height / 20);
}
if (!$cols) {
$cols = $width ? round($width / 6) : 80;
}
// Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor')
$defaulteditor = 'ckeditor';
$this->tool = empty($conf->global->FCKEDITOR_EDITORNAME) ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME;
$this->uselocalbrowser = $uselocalbrowser;
// Define content and some properties
if ($this->tool == 'ckeditor') {
$content = dol_htmlentitiesbr($content);
// If content is not HTML, we convert to HTML.
}
if ($this->tool == 'fckeditor') {
require_once DOL_DOCUMENT_ROOT . "/includes/fckeditor/fckeditor.php";
$content = dol_htmlentitiesbr($content);
// If content is not HTML, we convert to HTML.
$this->editor = new FCKeditor($htmlname);
$this->editor->BasePath = DOL_URL_ROOT . '/includes/fckeditor/';
$this->editor->Value = $content;
$this->editor->Height = $height;
if (!empty($width)) {
$this->editor->Width = $width;
}
$this->editor->ToolbarSet = $toolbarname;
$this->editor->Config['AutoDetectLanguage'] = 'true';
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
// Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
$modulepart = 'fckeditor';
$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart=' . $modulepart . '&file=';
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT . '/' . $modulepart . '/';
$this->editor->Config['LinkBrowser'] = $uselocalbrowser ? 'true' : 'false';
$this->editor->Config['ImageBrowser'] = $uselocalbrowser ? 'true' : 'false';
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/fckeditor/fckconfig.js')) {
$this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT . '/theme/' . $conf->theme . '/fckeditor/fckconfig.js';
$this->editor->Config['SkinPath'] = DOL_URL_ROOT . '/theme/' . $conf->theme . '/fckeditor/';
}
}
// Define some properties
if (in_array($this->tool, array('textarea', 'ckeditor'))) {
$this->content = $content;
$this->htmlname = $htmlname;
$this->toolbarname = $toolbarname;
$this->toolbarstartexpanded = $toolbarstartexpanded;
$this->rows = max(ROWS_3, $rows);
$this->cols = max(40, $cols);
$this->height = $height;
$this->width = $width;
}
}
示例11: check_user_password_empty
/**
* \brief Check user and password
* \param usertotest Login
* \param passwordtotest Password
* \return string Login if ok, '' if ko.
*/
function check_user_password_empty($usertotest,$passwordtotest)
{
dol_syslog("functions_empty::check_user_password_empty usertotest=".$usertotest);
$login='';
return $login;
}
示例12: loadBox
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 10)
{
global $user, $langs, $db, $conf;
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
$ficheinterstatic = new Fichinter($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastFicheInter", $max));
if ($user->rights->ficheinter->lire) {
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut,";
$sql .= " f.datec,";
$sql .= " f.date_valid as datev,";
$sql .= " f.tms as datem,";
$sql .= " s.nom, s.rowid as socid, s.client";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ", " . MAIN_DB_PREFIX . "fichinter as f";
$sql .= " WHERE f.fk_soc = s.rowid ";
$sql .= " AND f.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 f.tms DESC";
$sql .= $db->plimit($max, 0);
dol_syslog(get_class($this) . '::loadBox sql=' . $sql, LOG_DEBUG);
$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);
$ficheinterstatic->statut = $objp->fk_statut;
$ficheinterstatic->id = $objp->rowid;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/fichinter/fiche.php?id=" . $objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref ? $objp->ref : $objp->rowid, 'url' => DOL_URL_ROOT . "/fichinter/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' => $ficheinterstatic->getLibStatut(6), 'asis' => 1);
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedInterventions"));
}
$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"));
}
}
示例13: check_user_password_http
/**
* Check validity of user/password/entity
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
*
* @param string $usertotest Login
* @param string $passwordtotest Password
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
* @return string Login if OK, '' if KO
*/
function check_user_password_http($usertotest, $passwordtotest, $entitytotest)
{
dol_syslog("functions_http::check_user_password_http _SERVER[REMOTE_USER]=" . (empty($_SERVER["REMOTE_USER"]) ? '' : $_SERVER["REMOTE_USER"]));
$login = '';
if (!empty($_SERVER["REMOTE_USER"])) {
$login = $_SERVER["REMOTE_USER"];
}
return $login;
}
示例14: loadBox
/**
* \brief Load data into info_box_contents array to show array later.
* \param $max Maximum number of records to load
*/
function loadBox($max = 5)
{
global $user, $langs, $db, $conf;
$this->max = $max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
if ($user->rights->banque->lire) {
$sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,";
$sql .= " code_banque, code_guichet, cle_rib, bic, iban_prefix,";
$sql .= " domiciliation, proprio, adresse_proprio,";
$sql .= " account_number, currency_code,";
$sql .= " min_allowed, min_desired, comment";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
$sql .= " WHERE entity = " . $conf->entity;
//feito para o kurt, um sql diferente se o usuário for o CBA (id 7), ele só pode ver a conta mineirao (id 3)
if ($user->id == 7) {
$sql .= " AND rowid = 3";
}
$sql .= " AND clos = 0";
$sql .= " AND courant = 1";
$sql .= " ORDER BY label";
$sql .= $db->plimit($max, 0);
dol_syslog("Box_comptes::loadBox sql=" . $sql);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$solde_total = 0;
$listofcurrencies = array();
$account_static = new Account($db);
while ($i < $num) {
$objp = $db->fetch_object($result);
$account_static->id = $objp->rowid;
$solde = $account_static->solde(0);
$solde_total += $solde;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/compta/bank/account.php?account=" . $objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->label, 'url' => DOL_URL_ROOT . "/compta/bank/account.php?account=" . $objp->rowid);
$this->info_box_contents[$i][2] = array('td' => 'align="left"', 'text' => $objp->number);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => price($solde) . ' ' . $langs->trans("Currency" . $objp->currency_code));
$listofcurrencies[$objp->currency_code] = 1;
$i++;
}
// Total
if (sizeof($listofcurrencies) <= 1) {
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" class="liste_total"', 'text' => $langs->trans('Total'));
$this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"', 'text' => ' ');
$this->info_box_contents[$i][2] = array('td' => 'align="right" class="liste_total"', 'text' => ' ');
$totalamount = price($solde_total) . ' ' . $langs->trans("Currency" . $conf->monnaie);
$this->info_box_contents[$i][3] = array('td' => 'align="right" class="liste_total"', 'text' => $totalamount);
}
} else {
dol_print_error($db);
}
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例15: 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;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
$thirdpartystatic = new Societe($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));
if ($user->rights->societe->lire) {
$sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE s.client IN (1, 3)";
$sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")";
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 s.tms DESC";
$sql .= $db->plimit($max, 0);
dol_syslog(get_class($this) . "::loadBox sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$url = DOL_URL_ROOT . "/comm/fiche.php?socid=";
} else {
$url = DOL_URL_ROOT . "/societe/soc.php?socid=";
}
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$datec = $db->jdate($objp->datec);
$datem = $db->jdate($objp->tms);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $url . $objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => $url . $objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3));
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedCustomers"));
}
$db->free($result);
} 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('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}