本文整理汇总了PHP中dol_time_plus_duree函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_time_plus_duree函数的具体用法?PHP dol_time_plus_duree怎么用?PHP dol_time_plus_duree使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_time_plus_duree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dol_htmloutput_mesg
break;
case 'nodatefin':
$errors[] = $langs->trans('NoDateFin');
break;
case 'DureeHoliday':
$errors[] = $langs->trans('ErrorDureeCP');
break;
case 'alreadyCP':
$errors[] = $langs->trans('alreadyCPexist');
break;
}
dol_htmloutput_mesg('', $errors, 'error');
}
$delayForRequest = $cp->getConfCP('delayForRequest');
//$delayForRequest = $delayForRequest * (60*60*24);
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
print '<script type="text/javascript">
function valider()
{
if(document.demandeCP.date_debut_.value != "")
{
if(document.demandeCP.date_fin_.value != "")
{
if(document.demandeCP.valideur.value != "-1") {
return true;
}
else {
alert("' . dol_escape_js($langs->transnoentities('InvalidValidatorCP')) . '");
return false;
}
}
示例2: cotisation
/**
* Insert subscription into database and eventually add links to banks, mailman, etc...
*
* @param timestamp $date Date d'effet de la cotisation
* @param amount $montant Montant cotisation (accepte 0 pour les adherents non soumis e cotisation)
* @param int $accountid Id compte bancaire
* @param string $operation Type operation (si Id compte bancaire fourni)
* @param string $label Label operation (si Id compte bancaire fourni)
* @param string $num_chq Numero cheque (si Id compte bancaire fourni)
* @param string $emetteur_nom Nom emetteur cheque
* @param string $emetteur_banque Nom banque emetteur cheque
* @param timestamp $datesubend Date fin adhesion
* @return int rowid of record added, <0 if KO
*/
function cotisation($date, $montant, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
{
global $conf, $langs, $user;
$error = 0;
// Clean parameters
if (!$montant) {
$montant = 0;
}
if ($datesubend) {
$datefin = $datesubend;
} else {
// If no end date, end date = date + 1 year - 1 day
$datefin = dol_time_plus_duree($date, 1, 'y');
$datefin = dol_time_plus_duree($datefin, -1, 'd');
}
// Create subscription
$cotisation = new stdClass($this->db);
$cotisation->dateh = $date;
// Date of new subscription
$cotisation->datef = $datefin;
// End data of new subscription
$cotisation->amount = (double) $montant;
$cotisation->note = $label;
$cotisation->year = (int) strftime("%Y", $date);
$this->cotisations[] = $cotisation;
// Change properties of object (used by triggers)
$this->last_subscription_date = dol_now();
$this->last_subscription_amount = $montant;
$this->last_subscription_date_start = $date;
$this->last_subscription_date_end = $datefin;
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
$interface = new Interfaces($this->db);
$result = $interface->run_triggers('MEMBER_SUBSCRIPTION', $this, $user, $langs, $conf);
if ($result < 0) {
$error++;
$this->errors = $interface->errors;
}
// Fin appel triggers
$this->record();
return $rowid;
}
示例3: cotisation
/**
* Insert subscription into database and eventually add links to banks, mailman, etc...
*
* @param int $date Date of effect of subscription
* @param double $montant Amount of subscription (0 accepted for some members)
* @param int $accountid Id bank account
* @param string $operation Type operation (if Id bank account provided)
* @param string $label Label operation (if Id bank account provided)
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque
* @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO
*/
function cotisation($date, $montant, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
{
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php';
$error = 0;
// Clean parameters
if (!$montant) {
$montant = 0;
}
$this->db->begin();
if ($datesubend) {
$datefin = $datesubend;
} else {
// If no end date, end date = date + 1 year - 1 day
$datefin = dol_time_plus_duree($date, 1, 'y');
$datefin = dol_time_plus_duree($datefin, -1, 'd');
}
// Create subscription
$cotisation = new Cotisation($this->db);
$cotisation->fk_adherent = $this->id;
$cotisation->dateh = $date;
// Date of new subscription
$cotisation->datef = $datefin;
// End data of new subscription
$cotisation->amount = $montant;
$cotisation->note = $label;
$rowid = $cotisation->create($user);
if ($rowid > 0) {
// Update denormalized subscription end date (read database subscription to find values)
// This will also update this->datefin
$result = $this->update_end_date($user);
if ($result > 0) {
// Change properties of object (used by triggers)
$this->last_subscription_date = dol_now();
$this->last_subscription_amount = $montant;
$this->last_subscription_date_start = $date;
$this->last_subscription_date_end = $datefin;
// Call trigger
$result = $this->call_trigger('MEMBER_SUBSCRIPTION', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return $rowid;
} else {
$this->db->rollback();
return -2;
}
} else {
$this->error = $cotisation->error;
$this->db->rollback();
return -1;
}
}
示例4: dol_now
$now = dol_now('tzserver');
$duration_value = isset($argv[2]) ? $argv[2] : 'none';
print $script_file . " launched with mode " . $mode . " default lang=" . $langs->defaultlang . (is_numeric($duration_value) ? " delay=" . $duration_value : "") . "\n";
if ($mode != 'confirm') {
$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
}
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, s.email, s.default_lang,";
$sql .= " u.rowid as uid, u.lastname, u.firstname, u.email, u.lang";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql .= " , " . MAIN_DB_PREFIX . "societe as s";
$sql .= " , " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql .= " , " . MAIN_DB_PREFIX . "user as u";
$sql .= " WHERE f.fk_statut = 1 AND f.paye = 0";
$sql .= " AND f.fk_soc = s.rowid";
if (is_numeric($duration_value)) {
$sql .= " AND f.date_lim_reglement < '" . $db->idate(dol_time_plus_duree($now, $duration_value, "d")) . "'";
}
$sql .= " AND sc.fk_soc = s.rowid";
$sql .= " AND sc.fk_user = u.rowid";
$sql .= " ORDER BY u.email ASC, s.rowid ASC, f.facnumber ASC";
// Order by email to allow one message per email
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$oldemail = 'none';
$olduid = 0;
$oldlang = '';
$total = 0;
$foundtoprocess = 0;
示例5: foreach
$showheader = true;
$var = false;
foreach ($usernames as $username) {
$var = !$var;
echo "<tr>";
echo '<td class="cal_current_month cal_peruserviewname"' . ($var ? ' style="background: #F8F8F8"' : '') . '>' . $username->getNomUrl(1) . '</td>';
$tmpday = $sav;
// Lopp on each day of week
$i = 0;
for ($iter_day = 0; $iter_day < 8; $iter_day++) {
if ($i + 1 < $begin_d || $i + 1 > $end_d) {
$i++;
continue;
}
// Show days of the current week
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
$tmparray = dol_getdate($curtime, 'fast');
$tmpday = $tmparray['mday'];
$tmpmonth = $tmparray['mon'];
$tmpyear = $tmparray['year'];
$style = 'cal_current_month';
if ($iter_day == 6) {
$style .= ' cal_other_month';
}
$today = 0;
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) {
$today = 1;
}
if ($today) {
$style = 'cal_today_peruser';
}
示例6: dol_time_plus_duree
// Jump on next occurence
$numofevent++;
$savdatecurstart = $datecurstart;
if ($icalevent['RRULE']['FREQ'] == 'DAILY') {
$datecurstart = dol_time_plus_duree($datecurstart, $interval, 'd');
$datecurend = dol_time_plus_duree($datecurend, $interval, 'd');
}
if ($icalevent['RRULE']['FREQ'] == 'WEEKLY') {
$datecurstart = dol_time_plus_duree($datecurstart, $interval, 'w');
$datecurend = dol_time_plus_duree($datecurend, $interval, 'w');
} elseif ($icalevent['RRULE']['FREQ'] == 'MONTHLY') {
$datecurstart = dol_time_plus_duree($datecurstart, $interval, 'm');
$datecurend = dol_time_plus_duree($datecurend, $interval, 'm');
} elseif ($icalevent['RRULE']['FREQ'] == 'YEARLY') {
$datecurstart = dol_time_plus_duree($datecurstart, $interval, 'y');
$datecurend = dol_time_plus_duree($datecurend, $interval, 'y');
}
// Test to avoid infinite loop ($datecurstart must increase)
if ($savdatecurstart >= $datecurstart) {
dol_syslog("Found a rule freq " . $icalevent['RRULE']['FREQ'] . " not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
$datecurstart += 3600 * 24 * 7;
$datecurend += 3600 * 24 * 7;
}
}
}
}
$icalevents = array_merge($icalevents, $moreicalevents);
// Loop on each entry into cal file to know if entry is qualified and add an ActionComm into $eventarray
foreach ($icalevents as $icalevent) {
//print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
if (!empty($icalevent['RRULE'])) {
示例7: dol_now
$today = dol_now();
$datefrom = 0;
$dateto = 0;
$paymentdate = -1;
// Date payment
if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) {
$paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
}
// Date start subscription
print '<tr><td width="30%" class="fieldrequired">' . $langs->trans("DateSubscription") . '</td><td>';
if (GETPOST('reday')) {
$datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
}
if (!$datefrom) {
if ($object->datefin > 0) {
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
} else {
//$datefrom=dol_now();
$datefrom = $object->datevalid;
}
}
print $form->select_date($datefrom, '', '', '', '', "cotisation", 1, 1, 1);
print "</td></tr>";
// Date end subscription
if (GETPOST('endday')) {
$dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
}
if (!$dateto) {
$dateto = -1;
// By default, no date is suggested
}
示例8: testDolTimePlusDuree
/**
* testDolTimePlusDuree
*
* @return int
*/
public function testDolTimePlusDuree()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// Check dayhour format for fr_FR
$outputlangs=new Translate('',$conf);
$outputlangs->setDefaultLang('fr_FR');
$outputlangs->load("main");
$result=dol_print_date(dol_time_plus_duree(dol_time_plus_duree(dol_time_plus_duree(0,1,'m'),1,'y'),1,'d'),'dayhour',true,$outputlangs);
print __METHOD__." result=".$result."\n";
$this->assertEquals('02/02/1971 00:00',$result);
return $result;
}
示例9: loadBox
/**
* Charge les donnees en memoire pour affichage ulterieur
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$totalMnt = 0;
$totalnb = 0;
$i = 0;
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
$nbofyears = 2;
if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) {
$nbofyears = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
}
$textHead = $langs->trans("Activity") . ' (' . $nbofyears . ' ' . $langs->trans("DurationYears") . ')';
$this->info_box_head = array('text' => $textHead, 'limit' => dol_strlen($textHead));
// compute the year limit to show
$tmpdate = dol_time_plus_duree(dol_now(), -1 * $nbofyears, "y");
// list the summary of the bills
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$facturestatic = new Facture($db);
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ")";
$sql .= " WHERE 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 .= " AND f.fk_soc = s.rowid";
$sql .= " AND f.datef >= '" . $db->idate($tmpdate) . "' AND paye=1";
$sql .= " GROUP BY f.fk_statut";
$sql .= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
while ($i < $num) {
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill');
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills") . " " . $facturestatic->LibStatut(1, $objp->fk_statut, 0) . " " . $objp->annee);
$billurl = "viewstatut=2&paye=1&year=" . $objp->annee;
$this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $objp->nb, 'url' => DOL_URL_ROOT . "/compta/facture/list.php?" . $billurl . "&mainmenu=accountancy&leftmenu=customers_bills");
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => price($objp->Mnttot, 1, $langs, 0, 0, -1, $conf->currency));
// We add only for the current year
if ($objp->annee == date("Y")) {
$totalnb += $objp->nb;
$totalMnt += $objp->Mnttot;
}
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(1, $objp->fk_statut, 3));
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedInvoices"));
}
$db->free($result);
} else {
dol_print_error($db);
}
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f";
$sql .= " WHERE f.entity = " . $conf->entity;
$sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND paye=0";
$sql .= " GROUP BY f.fk_statut";
$sql .= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result) + $i;
$now = dol_now();
while ($i < $num) {
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill');
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills") . " " . $facturestatic->LibStatut(0, $objp->fk_statut, 0));
$billurl = "viewstatut=" . $objp->fk_statut . "&paye=0";
$this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $objp->nb, 'url' => DOL_URL_ROOT . "/compta/facture/list.php?" . $billurl . "&mainmenu=accountancy&leftmenu=customers_bills");
$totalnb += $objp->nb;
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => price($objp->Mnttot, 1, $langs, 0, 0, -1, $conf->currency));
$totalMnt += $objp->Mnttot;
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(0, $objp->fk_statut, 3));
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedInvoices"));
}
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
}
}
// list the summary of the orders
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
//.........这里部分代码省略.........
示例10: dol_mktime
$sql .= " s.rowid as socid, p.ref as prod_ref, p.label as product_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . $tables_from;
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON d.fk_product = p.rowid ';
$sql .= $where;
if ($month > 0) {
if ($year > 0) {
$start = dol_mktime(0, 0, 0, $month, 1, $year);
$end = dol_time_plus_duree($start, 1, 'm') - 1;
$sql .= " AND " . $dateprint . " BETWEEN '" . $db->idate($start) . "' AND '" . $db->idate($end) . "'";
} else {
$sql .= " AND date_format(" . $dateprint . ", '%m') = '" . sprintf('%02d', $month) . "'";
}
} else {
if ($year > 0) {
$start = dol_mktime(0, 0, 0, 1, 1, $year);
$end = dol_time_plus_duree($start, 1, 'y') - 1;
$sql .= " AND " . $dateprint . " BETWEEN '" . $db->idate($start) . "' AND '" . $db->idate($end) . "'";
}
}
if ($sref) {
$sql .= " AND " . $doc_number . " LIKE '%" . $sref . "%'";
}
if ($sprod_fulldescr) {
$sql .= " AND (d.description LIKE '%" . $sprod_fulldescr . "%' OR p.label LIKE '%" . $sprod_fulldescr . "%')";
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
// Define type of elements
$typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'));
$button = '<input type="submit" class="button" name="button_third" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
$param = "&sref=" . $sref . "&month=" . $month . "&year=" . $year . "&sprod_fulldescr=" . $sprod_fulldescr . "&socid=" . $socid . "&type_element=" . $type_element;
示例11: dol_getmypid
@set_time_limit(0);
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
dol_syslog($script_file . " launched with arg " . join(',', $argv));
$now = dol_now('tzserver');
$duration_value = isset($argv[2]) ? $argv[2] : 'none';
print $script_file . " launched with mode " . $mode . " default lang=" . $langs->defaultlang . (is_numeric($duration_value) ? " delay=" . $duration_value : "") . "\n";
if ($mode != 'confirm') {
$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
}
$sql = "SELECT DISTINCT c.ref, c.fk_soc, cd.date_fin_validite, cd.total_ttc, cd.description as description, p.label as plabel, s.rowid, s.nom as name, s.email, s.default_lang,";
$sql .= " u.rowid as uid, u.lastname, u.firstname, u.email, u.lang";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe AS s, " . MAIN_DB_PREFIX . "contrat AS c, " . MAIN_DB_PREFIX . "contratdet AS cd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product AS p ON p.rowid = cd.fk_product, " . MAIN_DB_PREFIX . "societe_commerciaux AS sc, " . MAIN_DB_PREFIX . "user AS u";
$sql .= " WHERE s.rowid = c.fk_soc AND c.rowid = cd.fk_contrat AND c.statut > 0 AND cd.statut<5";
if (is_numeric($duration_value)) {
$sql .= " AND cd.date_fin_validite < '" . $db->idate(dol_time_plus_duree($now, $duration_value, "d")) . "'";
}
$sql .= " AND sc.fk_soc = s.rowid AND sc.fk_user = u.rowid";
$sql .= " ORDER BY u.email ASC, s.rowid ASC, c.ref ASC";
// Order by email to allow one message per email
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$oldemail = 'none';
$olduid = 0;
$oldlang = '';
$total = 0;
$foundtoprocess = 0;
print "We found " . $num . " couples (services to expire - sale representative) qualified\n";
示例12: mktime
$today = mktime();
$datefrom = 0;
$dateto = 0;
$paymentdate = -1;
// Date payment
if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"]) {
$paymentdate = dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
}
// Date start subscription
print '<tr><td width="30%" class="fieldrequired">' . $langs->trans("DateSubscription") . '</td><td>';
if ($_POST["reday"]) {
$datefrom = dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
}
if (!$datefrom) {
if ($adh->datefin > 0) {
$datefrom = dol_time_plus_duree($adh->datefin, 1, 'd');
} else {
$datefrom = mktime();
}
}
$html->select_date($datefrom, '', '', '', '', "cotisation");
print "</td></tr>";
// Date end subscription
if ($_POST["endday"]) {
$dateto = dol_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
}
if (!$dateto) {
$dateto = -1;
// By default, no date is suggested
}
print '<tr><td>' . $langs->trans("DateEndSubscription") . '</td><td>';
示例13: GETPOST
$newduration = 0;
if (!empty($tmpduration[0])) {
$newduration += $tmpduration[0] * 3600;
}
if (!empty($tmpduration[1])) {
$newduration += $tmpduration[1] * 60;
}
if (!empty($tmpduration[2])) {
$newduration += $tmpduration[2];
}
if ($newduration > 0) {
$object->fetch($taskid);
$object->progress = GETPOST($taskid . 'progress', 'int');
$object->timespent_duration = $newduration;
$object->timespent_fk_user = $usertoprocess->id;
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
$result = $object->addTimeSpent($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
}
}
}
}
if (!$error) {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back
header('Location: ' . $_SERVER["PHP_SELF"] . ($projectid ? '?id=' . $projectid : '?') . ($mode ? '&mode=' . $mode : ''));
exit;
示例14: modAdherent
//.........这里部分代码省略.........
$this->menus[$r]->position = 5;
$this->menus[$r]->url = "/adherent/type.php";
$this->menus[$r]->langs = "members";
$this->menus[$r]->perms = '$user->rights->adherent->configurer';
$this->menus[$r]->enabled = '$conf->adherent->enabled';
$this->menus[$r]->usertype = 2;
$this->menus[$r]->title = "MembersTypes";
$this->menus[$r]->fk_menu = "menu:members";
$r++;
$this->menus[$r]->_id = "menu:newmember";
$this->menus[$r]->position = 0;
$this->menus[$r]->url = "/adherent/fiche.php?action=create";
$this->menus[$r]->langs = "members";
$this->menus[$r]->perms = '$user->rights->adherent->creer';
$this->menus[$r]->enabled = '$conf->adherent->enabled';
$this->menus[$r]->usertype = 2;
$this->menus[$r]->title = "NewMember";
$this->menus[$r]->fk_menu = "menu:members0";
$r++;
$this->menus[$r]->_id = "menu:list18";
$this->menus[$r]->position = 1;
$this->menus[$r]->url = "/adherent/list.php";
$this->menus[$r]->langs = "members";
$this->menus[$r]->perms = '$user->rights->adherent->lire';
$this->menus[$r]->enabled = '$conf->adherent->enabled';
$this->menus[$r]->usertype = 2;
$this->menus[$r]->title = "List";
$this->menus[$r]->fk_menu = "menu:members0";
$r++;
$this->menus[$r]->_id = "menu:cardmemberedit";
$this->menus[$r]->position = 10;
$this->menus[$r]->url = "/adherent/card.php";
$this->menus[$r]->langs = "members";
$this->menus[$r]->perms = '$user->rights->adherent->configurer';
$this->menus[$r]->enabled = '$conf->adherent->enabled';
$this->menus[$r]->usertype = 2;
$this->menus[$r]->title = "CardMember";
$this->menus[$r]->fk_menu = "menu:members";
// Exports
//--------
$r = 0;
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
$r++;
$this->export_code[$r] = $this->rights_class . '_' . $r;
$this->export_label[$r] = 'MembersAndSubscriptions';
$this->export_permission[$r] = array(array("adherent", "export"));
$this->export_fields_array[$r] = array('a.rowid' => 'Id', 'a.civilite' => "UserTitle", 'a.nom' => "Lastname", 'a.prenom' => "Firstname", 'a.login' => "Login", 'a.morphy' => 'MorPhy', 'a.societe' => 'Company', 'a.adresse' => "Address", 'a.cp' => "Zip", 'a.ville' => "Town", 'a.pays' => "Country", 'a.phone' => "PhonePro", 'a.phone_perso' => "PhonePerso", 'a.phone_mobile' => "PhoneMobile", 'a.email' => "Email", 'a.naiss' => "Birthday", 'a.statut' => "Status", 'a.photo' => "Photo", 'a.note' => "Note", 'a.datec' => 'DateCreation', 'a.datevalid' => 'DateValidation', 'a.tms' => 'DateLastModification', 'a.datefin' => 'DateEndSubscription', 'ta.rowid' => 'MemberTypeId', 'ta.libelle' => 'MemberTypeLabel', 'c.rowid' => 'SubscriptionId', 'c.dateadh' => 'DateSubscription', 'c.cotisation' => 'Amount');
$this->export_entities_array[$r] = array('a.rowid' => 'member', 'a.civilite' => "member", 'a.nom' => "member", 'a.prenom' => "member", 'a.login' => "member", 'a.morphy' => 'member', 'a.societe' => 'member', 'a.adresse' => "member", 'a.cp' => "member", 'a.ville' => "member", 'a.pays' => "member", 'a.phone' => "member", 'a.phone_perso' => "member", 'a.phone_mobile' => "member", 'a.email' => "member", 'a.naiss' => "member", 'a.statut' => "member", 'a.photo' => "member", 'a.note' => "member", 'a.datec' => 'member', 'a.datevalid' => 'member', 'a.tms' => 'member', 'a.datefin' => 'member', 'ta.rowid' => 'member_type', 'ta.libelle' => 'member_type', 'c.rowid' => 'subscription', 'c.dateadh' => 'subscription', 'c.cotisation' => 'subscription');
/*// Add extra fields
$sql = "SELECT name, label FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'member'";
$resql = $this->db->query($sql);
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.' . $obj->name;
$fieldlabel = ucfirst($obj->label);
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_entities_array[$r][$fieldname] = 'member';
}*/
// End add axtra fields
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'adherent_type as ta, ' . MAIN_DB_PREFIX . 'adherent as a)';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'adherent_extrafields as extra ON a.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'cotisation as c ON c.fk_adherent = a.rowid';
$this->export_sql_end[$r] .= ' WHERE a.fk_adherent_type = ta.rowid';
// Imports
//--------
$r = 0;
$now = dol_now();
require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
$r++;
$this->import_code[$r] = $this->rights_class . '_' . $r;
$this->import_label[$r] = "Members";
// Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = array();
// We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('a' => MAIN_DB_PREFIX . 'adherent', 'extra' => MAIN_DB_PREFIX . 'adherent_extrafields');
$this->import_tables_creator_array[$r] = array('a' => 'fk_user_author');
// Fields to store import user id
$this->import_fields_array[$r] = array('a.civilite' => "Civility", 'a.nom' => "Lastname*", 'a.prenom' => "Firstname", 'a.login' => "Login*", "a.pass" => "Password", "a.fk_adherent_type" => "MemberType*", 'a.morphy' => 'MorPhy*', 'a.societe' => 'Company', 'a.adresse' => "Address", 'a.cp' => "Zip", 'a.ville' => "Town", 'a.pays' => "Country", 'a.phone' => "PhonePro", 'a.phone_perso' => "PhonePerso", 'a.phone_mobile' => "PhoneMobile", 'a.email' => "Email", 'a.naiss' => "Birthday", 'a.statut' => "Status*", 'a.photo' => "Photo", 'a.note' => "Note", 'a.datec' => 'DateCreation', 'a.datefin' => 'DateEndSubscription');
/*// Add extra fields
$sql = "SELECT name, label FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'member'";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.' . $obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel;
}
}*/
// End add extra fields
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'adherent');
// aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array('a.civilite' => 'code@' . MAIN_DB_PREFIX . 'c_civilite', 'a.fk_adherent_type' => 'rowid@' . MAIN_DB_PREFIX . 'adherent_type', 'a.morphy' => '(phy|mor)', 'a.statut' => '^[0|1]', 'a.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'a.datefin' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r] = array('a.civilite' => "MR", 'a.nom' => 'Smith', 'a.prenom' => 'John', 'a.login' => 'jsmith', 'a.pass' => 'passofjsmith', 'a.fk_adherent_type' => '1', 'a.morphy' => '"mor" or "phy"', 'a.societe' => 'JS company', 'a.adresse' => '21 jump street', 'a.cp' => '55000', 'a.ville' => 'New York', 'a.pays' => '1', 'a.email' => 'jsmith@example.com', 'a.naiss' => '1972-10-10', 'a.statut' => "0 or 1", 'a.note' => "This is a comment on member", 'a.datec' => dol_print_date($now, '%Y-%m-%d'), 'a.datefin' => dol_print_date(dol_time_plus_duree($now, 1, 'y'), '%Y-%m-%d'));
}
示例15: dol_stringtotime
$error++;
print ' --> ' . $member->error;
}
print "\n";
//print_r($member);
$datefirst = '';
if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) {
$datefirst = dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]);
$pricefirst = price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT]);
}
$datelast = '';
if ($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) {
$datelast = dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE]);
$pricelast = price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]);
} elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) {
$datelast = dol_time_plus_duree(dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION]), -1, 'y') + 60 * 60 * 24;
$pricelast = price2num($ldapuser[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT]);
// Cas special ou date derniere <= date premiere
if ($datefirst && $datelast && $datelast <= $datefirst) {
// On ne va inserer que la premiere
$datelast = 0;
if (!$pricefirst && $pricelast) {
$pricefirst = $pricelast;
}
}
}
// Insert first subscription
if ($datefirst) {
// Cree premiere cotisation et met a jour datefin dans adherent
//print "xx".$datefirst."\n";
$crowid = $member->cotisation($datefirst, $pricefirst, 0);