当前位置: 首页>>代码示例>>PHP>>正文


PHP dol_now函数代码示例

本文整理汇总了PHP中dol_now函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_now函数的具体用法?PHP dol_now怎么用?PHP dol_now使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dol_now函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: archiverPropale

    static function archiverPropale(&$ATMdb, &$object)
    {
        global $langs;
        TPropaleHist::archivePDF($object);
        $newVersionPropale = new TPropaleHist();
        $newVersionPropale->serialized_parent_propale = serialize($object);
        $newVersionPropale->date_version = dol_now();
        $newVersionPropale->fk_propale = $object->id;
        $newVersionPropale->total = $object->total_ht;
        $newVersionPropale->save($ATMdb);
        ?>
				<script language="javascript">
					document.location.href="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?id=<?php 
        echo $_REQUEST['id'];
        ?>
&mesg=<?php 
        echo $langs->transnoentities('HistoryVersionSuccessfullArchived');
        ?>
";
				</script>
			<?php 
        /*if($_REQUEST['actionATM'] == 'createVersion') {
        			setEventMessage('Version sauvegardée avec succès.', 'mesgs');
        		}*/
    }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_propalehistory,代码行数:28,代码来源:propaleHist.class.php

示例2: 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;
}
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:34,代码来源:date.lib.php

示例3: create

 /**
  * Create bank information record
  *
  * @return	int		<0 if KO, >= 0 if OK
  */
 function create()
 {
     $now = dol_now();
     // Correct default_rib to be sure to have always one default
     $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "societe_rib where fk_soc = " . $this->socid . " AND default_rib = 1";
     $result = $this->db->query($sql);
     if ($result) {
         $numrows = $this->db->num_rows($result);
         if ($this->default_rib && $numrows > 0) {
             $this->default_rib = 0;
         }
         if (empty($this->default_rib) && $numrows == 0) {
             $this->default_rib = 1;
         }
     }
     $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_rib (fk_soc, datec)";
     $sql .= " VALUES (" . $this->socid . ", '" . $this->db->idate($now) . "')";
     $resql = $this->db->query($sql);
     if ($resql) {
         if ($this->db->affected_rows($resql)) {
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "societe_rib");
             return 1;
         }
     } else {
         print $this->db->error();
         return 0;
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:33,代码来源:companybankaccount.class.php

示例4: 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;
 }
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:accountancysystem.class.php

示例5: create

 /**
  *	Create promotion
  *
  *	@param	User	$user		Object user
  *	@param	int		$pid		Pid
  *	@param	int		$percent	Percent
  *	@return	int					<0 if KO, >0 if OK
  */
 function create($user, $pid, $percent)
 {
     global $conf;
     $sql = "SELECT products_price ";
     $sql .= " FROM " . $conf->global->OSC_DB_NAME . "." . $conf->global->OSC_DB_TABLE_PREFIX . "products as p";
     $sql .= " WHERE p.products_id = " . $pid;
     $result = $this->db->query($sql);
     if ($result) {
         $result = $this->db->fetch_array($result);
         $this->price_init = $result["products_price"];
     }
     $newprice = $percent * $this->price_init;
     $date_exp = "2003-05-01";
     // TODO ????
     $now = dol_now();
     $sql = "INSERT INTO " . $conf->global->OSC_DB_NAME . "." . $conf->global->OSC_DB_TABLE_PREFIX . "specials ";
     $sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
     $sql .= " VALUES ({$pid}, {$newprice}, '" . $this->db->idate($now) . "', NULL, '" . $this->db->idate($now + 3600 * 24 * 365) . "', NULL, 1)";
     if ($this->db->query($sql)) {
         $id = $this->db->last_insert_id(OSC_DB_NAME . ".specials");
         return $id;
     } else {
         print $this->db->error() . ' in ' . $sql;
     }
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:33,代码来源:promotion.class.php

示例6: loadBox

 /**
  * Load data into info_box_contents array to show array later.
  *
  * @param int $max of records to load
  *
  * @return void
  */
 public function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $this->max = $max;
     dol_include_once('/lead/class/lead.class.php');
     $lead = new Lead($db);
     $lead->fetch_all('DESC', 't.date_closure', $max, 0, array('t.date_closure<' => dol_now()));
     $text = $langs->trans("LeadLate", $max);
     $this->info_box_head = array('text' => $text, 'limit' => dol_strlen($text));
     $i = 0;
     foreach ($lead->lines as $line) {
         // FIXME: line is an array, not an object
         $line->fetch_thirdparty();
         // Ref
         $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
         $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $line->ref, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
         $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
         $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($line->thirdparty->name, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
         // Amount Guess
         $this->info_box_contents[$i][4] = array('td' => 'align="left"', 'text' => price($line->amount_prosp, 'HTML') . $langs->getCurrencySymbol($conf->currency));
         // Amount real
         $this->info_box_contents[$i][5] = array('td' => 'align="left"', 'text' => $line->getRealAmount() . $langs->getCurrencySymbol($conf->currency));
         $i++;
     }
 }
开发者ID:ndrosis,项目名称:lead,代码行数:32,代码来源:box_lead.php

示例7: loadBox

 /**
  *  Load data for box to show them later
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $user, $langs, $db, $conf;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
     $contractstatic = new Contrat($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts", $max));
     if ($user->rights->contrat->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE c.fk_soc = s.rowid";
         $sql .= " AND c.entity = " . $conf->entity;
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
         }
         if ($user->societe_id) {
             $sql .= " AND s.rowid = " . $user->societe_id;
         }
         $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $resql = $db->query($sql);
         if ($resql) {
             $num = $db->num_rows($resql);
             $now = dol_now();
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($resql);
                 $datec = $db->jdate($objp->datec);
                 $dateterm = $db->jdate($objp->fin_validite);
                 $dateclose = $db->jdate($objp->date_cloture);
                 $late = '';
                 $contractstatic->statut = $objp->fk_statut;
                 $contractstatic->id = $objp->rowid;
                 $result = $contractstatic->fetch_lines();
                 // fin_validite is no more on contract but on services
                 // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/contrat/fiche.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref ? $objp->ref : $objp->rowid, 'text2' => $late, 'url' => DOL_URL_ROOT . "/contrat/fiche.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($objp->nom, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec, 'day'));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', 'text' => $contractstatic->getLibStatut(6), 'asis' => 1);
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedContracts"));
             }
             $db->free($resql);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:65,代码来源:box_contracts.php

示例8: 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 $user, $langs, $db, $conf;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
     $propalstatic = new Propal($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals", $max));
     if ($user->rights->propale->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "propal as p";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE p.fk_soc = s.rowid";
         $sql .= " AND p.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 p.datep DESC, p.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $now = dol_now();
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datec = $db->jdate($objp->datec);
                 $dateterm = $db->jdate($objp->fin_validite);
                 $dateclose = $db->jdate($objp->date_cloture);
                 $late = '';
                 if ($objp->fk_statut == 1 && $dateterm < $now - $conf->propal->cloture->warning_delay) {
                     $late = img_warning($langs->trans("Late"));
                 }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/comm/propal.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, 'text2' => $late, 'url' => DOL_URL_ROOT . "/comm/propal.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" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProposals"));
             }
             $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('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:64,代码来源:box_propales.php

示例9: 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"));
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:64,代码来源:box_ficheinter.php

示例10: loadBox

 /**
  *  Load data for box to show them later
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $user, $langs, $db, $conf;
     $this->max = $max;
     $now = dol_now();
     $this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices", $max));
     if ($user->rights->contrat->lire) {
         // Select contracts with at least one expired service
         $sql = "SELECT ";
         $sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
         $sql .= " s.nom as name, s.rowid as socid,";
         $sql .= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
         $sql .= " FROM " . MAIN_DB_PREFIX . "contrat as c, " . MAIN_DB_PREFIX . "societe s, " . MAIN_DB_PREFIX . "contratdet as cd";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '" . $db->idate($now) . "'";
         $sql .= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
         if ($user->societe_id) {
             $sql .= ' AND c.fk_soc = ' . $user->societe_id;
         }
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
         }
         $sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid";
         $sql .= " ORDER BY date_line ASC";
         $sql .= $db->plimit($max, 0);
         $resql = $db->query($sql);
         if ($resql) {
             $num = $db->num_rows($resql);
             $i = 0;
             while ($i < $num) {
                 $late = '';
                 $objp = $db->fetch_object($resql);
                 $dateline = $db->jdate($objp->date_line);
                 if ($dateline + $conf->contrat->services->expires->warning_delay < $now) {
                     $late = img_warning($langs->trans("Late"));
                 }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/contrat/card.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 . "/contrat/card.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($objp->name, 40), 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="center"', 'text' => dol_print_date($dateline, 'day'), 'text2' => $late);
                 $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => $objp->nb_services);
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoExpiredServices"));
             }
             $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"));
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:63,代码来源:box_services_expired.php

示例11: create

 /**
  *	Create object in database
  *
  *	@param		User	$user   User making creation
  *	@return 	int				<0 if KO, >0 if OK
  */
 function create($user)
 {
     global $conf, $langs;
     $error = 0;
     $ret = 0;
     $now = dol_now();
     // Clean parameters
     $this->address = $this->address > 0 ? $this->address : $this->address;
     $this->zip = $this->zip > 0 ? $this->zip : $this->zip;
     $this->town = $this->town > 0 ? $this->town : $this->town;
     $this->country_id = $this->country_id > 0 ? $this->country_id : $this->country_id;
     $this->db->begin();
     $sql = "INSERT INTO " . MAIN_DB_PREFIX . "establishment (";
     $sql .= "name";
     $sql .= ", address";
     $sql .= ", zip";
     $sql .= ", town";
     $sql .= ", status";
     $sql .= ", fk_country";
     $sql .= ", entity";
     $sql .= ", datec";
     $sql .= ", fk_user_author";
     $sql .= ") VALUES (";
     $sql .= " '" . $this->db->escape($this->name) . "'";
     $sql .= ", '" . $this->db->escape($this->address) . "'";
     $sql .= ", '" . $this->db->escape($this->zip) . "'";
     $sql .= ", '" . $this->db->escape($this->town) . "'";
     $sql .= ", " . $this->country_id;
     $sql .= ", " . $this->status;
     $sql .= ", " . $conf->entity;
     $sql .= ", '" . $this->db->idate($now) . "'";
     $sql .= ", " . $user->id;
     $sql .= ")";
     dol_syslog(get_class($this) . "::create", LOG_DEBUG);
     $resql = $this->db->query($sql);
     if (!$resql) {
         $error++;
         $this->errors[] = "Error " . $this->db->lasterror();
     }
     if (!$error) {
         $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "establishment");
     }
     // Commit or rollback
     if ($error) {
         foreach ($this->errors as $errmsg) {
             dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR);
             $this->error .= $this->error ? ', ' . $errmsg : $errmsg;
         }
         $this->db->rollback();
         return -1 * $error;
     } else {
         $this->db->commit();
         return $this->id;
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:61,代码来源:establishment.class.php

示例12: create

 /**
  * Create object in database
  * TODO Add ref number
  *
  * @param	User	$user	User that creates
  * @return 	int				<0 if KO, >0 if OK
  */
 function create($user)
 {
     global $conf;
     // Check parameters
     if (empty($this->type) || $this->type < 0) {
         $this->error = 'ErrorBadParameter';
         return -1;
     }
     if (empty($this->fk_user) || $this->fk_user < 0) {
         $this->error = 'ErrorBadParameter';
         return -1;
     }
     $now = dol_now();
     $this->db->begin();
     $sql = "INSERT INTO " . MAIN_DB_PREFIX . "deplacement (";
     $sql .= "datec";
     //$sql.= ", dated";
     $sql .= ", entity";
     $sql .= ", fk_user_author";
     $sql .= ", fk_user";
     $sql .= ", type";
     $sql .= ", note";
     $sql .= ", note_public";
     $sql .= ", fk_projet";
     $sql .= ", fk_soc";
     $sql .= ") VALUES (";
     $sql .= " '" . $this->db->idate($now) . "'";
     $sql .= ", " . $conf->entity;
     $sql .= ", " . $user->id;
     $sql .= ", " . $this->fk_user;
     $sql .= ", '" . $this->type . "'";
     $sql .= ", " . ($this->note_private ? "'" . $this->db->escape($this->note_private) . "'" : "null");
     $sql .= ", " . ($this->note_public ? "'" . $this->db->escape($this->note_public) . "'" : "null");
     $sql .= ", " . ($this->fk_project > 0 ? $this->fk_project : 0);
     $sql .= ", " . ($this->fk_soc > 0 ? $this->fk_soc : "null");
     $sql .= ")";
     dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
     $result = $this->db->query($sql);
     if ($result) {
         $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "deplacement");
         $result = $this->update($user);
         if ($result > 0) {
             $this->db->commit();
             return $this->id;
         } else {
             $this->error = $this->db->error();
             $this->db->rollback();
             return $result;
         }
     } else {
         $this->error = $this->db->error() . " sql=" . $sql;
         $this->db->rollback();
         return -1;
     }
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:62,代码来源:deplacement.class.php

示例13: 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;
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:56,代码来源:date.lib.php

示例14: create

 /**
  * Create bank information record
  *
  * @param   Object   $user		User
  * @return	int					<0 if KO, >= 0 if OK
  */
 function create($user = '')
 {
     $now = dol_now();
     $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rib (fk_user, datec)";
     $sql .= " VALUES (" . $this->userid . ", '" . $this->db->idate($now) . "')";
     $resql = $this->db->query($sql);
     if ($resql) {
         if ($this->db->affected_rows($resql)) {
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "user_rib");
             return 1;
         }
     } else {
         print $this->db->error();
         return 0;
     }
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:22,代码来源:userbankaccount.class.php

示例15: create

    /**
     * Create bank information record
     *
     * @return	int		<0 if KO, >= 0 if OK
     */
    function create()
    {
        $now=dol_now();

        $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')";
        $resql=$this->db->query($sql);
        if ($resql)
        {
            if ($this->db->affected_rows($resql))
            {
                return 1;
            }
        }
        else
        {
            print $this->db->error();
            return 0;
        }
    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:24,代码来源:companybankaccount.class.php


注:本文中的dol_now函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。