本文整理汇总了PHP中dol_print_error函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_print_error函数的具体用法?PHP dol_print_error怎么用?PHP dol_print_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_print_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $conf;
$this->db = $db;
$this->arrayofproducts = array();
// List of services
$sql = "SELECT ref FROM " . MAIN_DB_PREFIX . "product";
$sql .= " WHERE entity IN (" . getEntity('product', 1) . ")";
if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
$sql .= " AND fk_product_type = 1";
}
// By default, only services
$sql .= " ORDER BY ref";
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
dol_syslog("dolibarr_services_expired.modules.php:mailing_dolibarr_services_expired " . $num . " services found");
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($result);
$i++;
$this->arrayofproducts[$i] = $obj->ref;
}
} else {
dol_print_error($this->db);
}
}
示例2: mailing_thirdparties_services_expired
/**
* Constructor
*
* @param $DB
* @return mailing_thirdparties_services_expired
*/
function mailing_thirdparties_services_expired($DB)
{
$this->db=$DB;
$this->arrayofproducts=array();
// List of services
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE fk_product_type = 1";
$sql.= " ORDER BY ref";
$result=$this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
dolibarr_syslog("dolibarr_services_expired.modules.php:mailing_dolibarr_services_expired ".$num." services found");
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$i++;
$this->arrayofproducts[$i]=$obj->ref;
}
}
else
{
dol_print_error($this->db);
}
}
示例3: loadBox
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$langs->load("boxes");
$this->max = $max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers", $max));
if ($user->rights->boutique->lire) {
$sql = "SELECT count(*) as cus FROM " . $conf->global->OSC_DB_NAME . "." . $conf->global->OSC_DB_TABLE_PREFIX . "customers";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('td' => 'align="center" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/boutique/client/index.php");
$this->info_box_contents[$i][1] = array('td' => 'align="center"', 'text' => $objp->cus, 'url' => DOL_URL_ROOT . "/boutique/client/index.php");
$i++;
}
} else {
dol_print_error($db);
}
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例4: getServerTimeZoneInt
/**
* Return server timezone int.
*
* @param string $refgmtdate Reference period for timezone (timezone differs on winter and summer. May be 'now', 'winter' or 'summer')
* @return int An offset in hour (+1 for Europe/Paris on winter and +2 for Europe/Paris on summer)
*/
function getServerTimeZoneInt($refgmtdate = 'now')
{
global $conf;
if (method_exists('DateTimeZone', 'getOffset')) {
// Method 1 (include daylight)
$gmtnow = dol_now('gmt');
$yearref = dol_print_date($gmtnow, '%Y');
$monthref = dol_print_date($gmtnow, '%m');
$dayref = dol_print_date($gmtnow, '%d');
if ($refgmtdate == 'now') {
$newrefgmtdate = $yearref . '-' . $monthref . '-' . $dayref;
} elseif ($refgmtdate == 'summer') {
$newrefgmtdate = $yearref . '-08-01';
} else {
$newrefgmtdate = $yearref . '-01-01';
}
$newrefgmtdate .= 'T00:00:00+00:00';
$localtz = new DateTimeZone(getServerTimeZoneString());
$localdt = new DateTime($newrefgmtdate, $localtz);
$tmp = -1 * $localtz->getOffset($localdt);
//print $refgmtdate.'='.$tmp;
} else {
$tmp = 0;
dol_print_error('', 'PHP version must be 5.3+');
}
$tz = round(($tmp < 0 ? 1 : -1) * abs($tmp / 3600));
return $tz;
}
示例5: load_state_board
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{
global $conf, $user;
$this->nb=array();
$sql = "SELECT count(p.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
$sql.= " AND p.fk_product_type = 1";
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$this->nb["services"]=$obj->nb;
}
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
return -1;
}
}
示例6: 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>';
}
示例7: load_state_board
/**
* Load indicators into this->nb for board
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{
global $conf, $user;
$this->nb = array("customers" => 0, "prospects" => 0);
$clause = "WHERE";
$sql = "SELECT count(s.rowid) as nb, s.client";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = " . $user->id;
$clause = "AND";
}
$sql .= " " . $clause . " s.client IN (1,2,3)";
$sql .= ' AND s.entity IN (' . getEntity($this->element, 1) . ')';
$sql .= " GROUP BY s.client";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if ($obj->client == 1 || $obj->client == 3) {
$this->nb["customers"] += $obj->nb;
}
if ($obj->client == 2 || $obj->client == 3) {
$this->nb["prospects"] += $obj->nb;
}
}
$this->db->free($resql);
return 1;
} else {
dol_print_error($this->db);
$this->error = $this->db->error();
return -1;
}
}
示例8: immobilier_pdf_create
/**
* \brief Crée un document PDF
* \param db objet base de donnee
* \param modele modele à utiliser
* \param outputlangs objet lang a utiliser pour traduction
* \return int <0 if KO, >0 if OK
*/
function immobilier_pdf_create($db, $id, $message, $typeModele, $outputlangs, $file)
{
global $conf, $langs;
$langs->load('immobilier@immobilier');
// Charge le modele
$nomModele = dol_buildpath('/immobilier/core/modules/immobilier/pdf/pdf_' . $typeModele . '.modules.php');
if (file_exists($nomModele)) {
require_once $nomModele;
$classname = "pdf_" . $typeModele;
$obj = new $classname($db);
$obj->message = $message;
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output = $outputlangs->charset_output;
if ($obj->write_file($id, $outputlangs, $file, $socid, $courrier) > 0) {
$outputlangs->charset_output = $sav_charset_output;
return 1;
} else {
$outputlangs->charset_output = $sav_charset_output;
dol_print_error($db, "pdf_create Error: " . $obj->error);
return -1;
}
} else {
dol_print_error('', $langs->trans("Error") . " " . $langs->trans("ErrorFileDoesNotExists", $file));
return -1;
}
}
示例9: fetch
/**
* Directs the bookmark
*
* @param int $id Bookmark Id Loader
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
{
global $conf;
$sql = "SELECT rowid, fk_user, dateb as datec, url, target,";
$sql .= " title, position, favicon";
$sql .= " FROM " . MAIN_DB_PREFIX . "bookmark";
$sql .= " WHERE rowid = " . $id;
$sql .= " AND entity = " . $conf->entity;
dol_syslog("Bookmark::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_user = $obj->fk_user;
$this->datec = $this->db->jdate($obj->datec);
$this->url = $obj->url;
$this->target = $obj->target;
$this->title = $obj->title;
$this->position = $obj->position;
$this->favicon = $obj->favicon;
$this->db->free($resql);
return $this->id;
} else {
dol_print_error($this->db);
return -1;
}
}
示例10: pt
function pt($db, $sql, $date)
{
global $conf, $bc, $langs;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="nowrap" width="60%">' . $date . '</td>';
print '<td align="right">' . $langs->trans("Amount") . '</td>';
print '<td> </td>' . "\n";
print "</tr>\n";
$var = True;
while ($i < $num) {
$obj = $db->fetch_object($result);
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td class="nowrap">' . $obj->dm . "</td>\n";
$total = $total + $obj->mm;
print '<td class="nowrap" align="right">' . price($obj->mm) . "</td><td > </td>\n";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td align="right">' . $langs->trans("Total") . " :</td><td nowrap=\"nowrap\" align=\"right\"><b>" . price($total) . "</b></td><td> </td></tr>";
print "</table>";
$db->free($result);
} else {
dol_print_error($db);
}
}
示例11: getServerTimeZoneInt
/**
* Return server timezone int.
*
* @param string $refgmtdate Reference period for timezone (timezone differs on winter and summer. May be 'now', 'winter' or 'summer')
* @return int An offset in hour (+1 for Europe/Paris on winter and +2 for Europe/Paris on summer)
*/
function getServerTimeZoneInt($refgmtdate = 'now')
{
global $conf;
if (method_exists('DateTimeZone', 'getOffset')) {
// Method 1 (include daylight)
$gmtnow = dol_now('gmt');
$yearref = dol_print_date($gmtnow, '%Y');
$monthref = dol_print_date($gmtnow, '%m');
$dayref = dol_print_date($gmtnow, '%d');
if ($refgmtdate == 'now') {
$newrefgmtdate = $yearref . '-' . $monthref . '-' . $dayref;
} elseif ($refgmtdate == 'summer') {
$newrefgmtdate = $yearref . '-08-01';
} else {
$newrefgmtdate = $yearref . '-01-01';
}
$localtz = new DateTimeZone(getServerTimeZoneString());
$localdt = new DateTime($newrefgmtdate, $localtz);
$tmp = -1 * $localtz->getOffset($localdt);
//print $refgmtdate.'='.$tmp;
} else {
dol_print_error('', 'PHP version must be 5.3+');
/*
// Method 2 (does not include daylight, not supported by adodb)
if ($refgmtdate == 'now')
{
if (ini_get("date.timezone")=='UTC') return 0;
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client but this may be a bug.
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
if (dol_stringtotime($_SESSION['dol_dst_first']) <= $gmtnow && $gmtnow < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
else $daylight=0;
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
return 'unknown'; // For true result
}
elseif ($refgmtdate == 'summer')
{
if (ini_get("date.timezone")=='UTC') return 0;
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client but this may be a bug.
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref='08'; $dayref='01';
if (dol_stringtotime($_SESSION['dol_dst_first']) <= dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) && dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
else $daylight=0;
$tmp=dol_mktime(0,0,0,$monthref,$dayref,$yearref,false,0)-dol_mktime(0,0,0,$monthref,$dayref,$yearref,true,0)-($daylight*3600);
return 'unknown'; // For true result
}
else $tmp=dol_mktime(0,0,0,1,1,1970);
*/
}
$tz = round(($tmp < 0 ? 1 : -1) * abs($tmp / 3600));
return $tz;
}
示例12: __construct
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
parent::__construct($db);
try {
$this->couchdb->useDatabase('adherent');
$fk_extrafields = new ExtraFields($db);
$fk_extrafields->useDatabase('adherent');
$this->fk_extrafields = $fk_extrafields->load("extrafields:" . get_class($this), true);
// load and cache
} catch (Exception $e) {
dol_print_error('', $e->getMessage());
exit;
}
return 1;
}
示例13: printBookmarksList
/**
* Add area with bookmarks in menu
*
* @param DoliDb $aDb Database handler
* @param Translate $aLangs Object lang
* @return string
*/
function printBookmarksList($aDb, $aLangs)
{
global $conf, $user;
$db = $aDb;
$langs = $aLangs;
require_once DOL_DOCUMENT_ROOT . '/bookmarks/class/bookmark.class.php';
if (!isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
$conf->global->BOOKMARKS_SHOW_IN_MENU = 5;
}
$bookm = new Bookmark($db);
$langs->load("bookmarks");
$url = $_SERVER["PHP_SELF"] . (!empty($_SERVER["QUERY_STRING"]) ? '?' . $_SERVER["QUERY_STRING"] : '');
$ret = '';
// Menu bookmark
$ret .= '<div class="menu_titre">';
$ret .= '<table class="nobordernopadding" width="100%" summary="bookmarkstable"><tr><td>';
$ret .= '<a class="vmenu" href="' . DOL_URL_ROOT . '/bookmarks/liste.php">' . $langs->trans('Bookmarks') . '</a>';
$ret .= '</td><td align="right">';
if ($user->rights->bookmark->creer) {
$ret .= '<a class="vsmenu" href="' . DOL_URL_ROOT . '/bookmarks/fiche.php?action=create&urlsource=' . urlencode($url) . '&url=' . urlencode($url) . '">';
//$ret.=img_picto($langs->trans('AddThisPageToBookmarks'),'edit_add').' ';
$ret .= img_object($langs->trans('AddThisPageToBookmarks'), 'bookmark');
$ret .= '</a>';
}
$ret .= '</td></tr></table>';
$ret .= '</div>';
$ret .= '<div class="menu_top"></div>' . "\n";
// Menu with all bookmarks
if (!empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
$sql = "SELECT rowid, title, url, target FROM " . MAIN_DB_PREFIX . "bookmark";
$sql .= " WHERE (fk_user = " . $user->id . " OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity = " . $conf->entity;
$sql .= " ORDER BY position";
if ($resql = $db->query($sql)) {
$i = 0;
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && ($obj = $db->fetch_object($resql))) {
$ret .= '<div class="menu_contenu"><a class="vsmenu" title="' . $obj->title . '" href="' . $obj->url . '"' . ($obj->target == 1 ? ' target="_blank"' : '') . '>';
$ret .= ' ' . img_object('', 'bookmark') . ' ';
$ret .= dol_trunc($obj->title, 20) . '</a><br></div>';
$i++;
}
} else {
dol_print_error($db);
}
}
$ret .= '<div class="menu_end"></div>';
return $ret;
}
示例14: getNextNumRef
/**
* Return next reference of ticket not already used (or last reference)
* according to numbering module defined into constant FACSIM_ADDON
* @param soc objet company
* @param mode 'next' for next value or 'last' for last value
* @return string free ref or last ref
*/
function getNextNumRef($soc, $mode = 'next')
{
global $conf, $db, $langs;
$langs->load("bills");
// Clean parameters (if not defined or using deprecated value)
if (empty($conf->global->FACSIM_ADDON)) {
$conf->global->FACSIM_ADDON = 'mod_facsim_alcoy';
} else {
if ($conf->global->FACSIM_ADDON == 'alcoy') {
$conf->global->FACSIM_ADDON = 'mod_facsim_alcoy';
}
}
$mybool = false;
$file = $conf->global->FACSIM_ADDON . ".php";
$classname = $conf->global->FACSIM_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot) {
$dir = $dirroot . "/pos/backend/numerotation/numerotation_facsim/";
// Load file with numbering class (if found)
$mybool |= @(include_once $dir . $file);
}
// For compatibility
if (!$mybool) {
$file = $conf->global->FACSIM_ADDON . "/" . $conf->global->FACSIM_ADDON . ".modules.php";
$classname = "mod_facsim_" . $conf->global->FACSIM_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot) {
$dir = $dirroot . "/pos/backend/numerotation/numerotation_facsim/";
// Load file with numbering class (if found)
$mybool |= @(include_once $dir . $file);
}
}
//print "xx".$mybool.$dir.$file."-".$classname;
if (!$mybool) {
dol_print_error('', "Failed to include file " . $file);
return '';
}
$obj = new $classname();
$numref = "";
$numref = $obj->getNumRef($soc, $this, $mode);
if ($numref != "") {
return $numref;
} else {
//dol_print_error($db,"Ticket::getNextNumRef ".$obj->error);
return false;
}
}
示例15: llxHeader
/**
* Replace the default llxHeader function
* @param $head
* @param $title
* @param $help_url
* @param $target
* @param $disablejs
* @param $disablehead
* @param $arrayofjs
* @param $arrayofcss
*/
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
{
global $db, $user, $conf, $langs;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
$menu = new Menu();
// Entry for each bank account
if ($user->rights->banque->lire)
{
$sql = "SELECT rowid, label, courant, rappro, courant";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND clos = 0";
$sql.= " ORDER BY label";
$resql = $db->query($sql);
if ($resql)
{
$numr = $db->num_rows($resql);
$i = 0;
if ($numr > 0) $menu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr)
{
$objp = $db->fetch_object($resql);
$menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && ! $objp->clos) // If not cash account and not closed and can be reconciliate
{
$menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}
}
else dol_print_error($db);
$db->free($resql);
}
left_menu('', $help_url, '', $menu->liste, 1);
main_area();
}