コード例 #1
0
                    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
0
ファイル: adherent.class.php プロジェクト: nrjacker4/crm-php
 /**
  * 	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
0
 /**
  *	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
0
$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
0
ファイル: peruser.php プロジェクト: ADDAdev/Dolibarr
$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
0
ファイル: index.php プロジェクト: nrjacker4/crm-php
             // 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
0
 $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
0
ファイル: DateLibTest.php プロジェクト: nrjacker4/crm-php
    /**
     * 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
0
 /**
  *  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 = "******" 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") . "&nbsp;" . $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") . "&nbsp;" . $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';
         $commandestatic = new Commande($db);
         $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
         $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= ")";
         $sql .= " WHERE c.entity = " . $conf->entity;
         $sql .= " AND c.fk_soc = s.rowid";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " AND c.date_commande >= '" . $db->idate($tmpdate) . "'";
         $sql .= " AND c.facture=0";
         $sql .= " GROUP BY c.fk_statut";
         $sql .= " ORDER BY c.fk_statut DESC";
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result) + $i;
             while ($i < $num) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'object_order');
                 $objp = $db->fetch_object($result);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Orders") . "&nbsp;" . $commandestatic->LibStatut($objp->fk_statut, 0, 0));
                 $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $objp->nb, 'url' => DOL_URL_ROOT . "/commande/liste.php?mainmenu=commercial&leftmenu=orders&viewstatut=" . $objp->fk_statut);
                 $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' => $commandestatic->LibStatut($objp->fk_statut, 0, 3));
                 $i++;
             }
         } else {
             dol_print_error($db);
         }
     }
     // list the summary of the propals
     if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
         include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
         $propalstatic = new Propal($db);
         $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
         $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as p";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= ")";
         $sql .= " WHERE p.entity = " . $conf->entity;
         $sql .= " AND p.fk_soc = s.rowid";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " AND p.datep >= '" . $db->idate($tmpdate) . "'";
         $sql .= " AND p.date_cloture IS NULL";
         // just unclosed
         $sql .= " GROUP BY p.fk_statut";
         $sql .= " ORDER BY p.fk_statut DESC";
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result) + $i;
             while ($i < $num) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'object_propal');
                 $objp = $db->fetch_object($result);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Proposals") . "&nbsp;" . $propalstatic->LibStatut($objp->fk_statut, 0));
                 $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $objp->nb, 'url' => DOL_URL_ROOT . "/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=" . $objp->fk_statut);
                 $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' => $propalstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
         } else {
             dol_print_error($db);
         }
     }
     // Add the sum in the bottom of the boxes
     $this->info_box_contents[$i][1] = array('td' => 'align="left" ', 'text' => $langs->trans("Total") . "&nbsp;" . $textHead);
     $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => price($totalnb, 1, $langs, 0, 0, -1, $conf->currency));
     $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => price($totalMnt, 1, $langs, 0, 0, -1, $conf->currency));
     $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => "");
     $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => "");
 }
コード例 #10
0
$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 = "&amp;sref=" . $sref . "&amp;month=" . $month . "&amp;year=" . $year . "&amp;sprod_fulldescr=" . $sprod_fulldescr . "&amp;socid=" . $socid . "&amp;type_element=" . $type_element;
コード例 #11
0
@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
0
 $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
0
ファイル: perweek.php プロジェクト: Albertopf/prueba
             $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
0
 /**
  *   Constructor. Define names, constants, directories, boxes, permissions
  *
  *   @param      DoliDB		$db      Database handler
  */
 function modAdherent($db)
 {
     parent::__construct($db);
     $this->numero = 310;
     $this->family = "hr";
     // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
     $this->name = strtolower(preg_replace('/^mod/i', '', get_class($this)));
     $this->description = "Gestion des adhérents d'une association";
     $this->version = 'speedealing';
     // 'experimental' or 'dolibarr' or version
     $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
     $this->special = 0;
     $this->picto = 'user';
     // Data directories to create when module is enabled
     $this->dirs = array("/adherent/temp");
     // Config pages
     //-------------
     $this->config_page_url = array("adherent.php@adherent");
     // Dependances
     //------------
     $this->depends = array();
     $this->requiredby = array('modMailmanSpip');
     $this->langfiles = array("members", "companies");
     // Constantes
     //-----------
     $this->const = array();
     $this->const[2] = array("MAIN_SEARCHFORM_ADHERENT", "yesno", "1", "Show form for quick member search");
     $this->const[3] = array("ADHERENT_MAIL_RESIL", "texte", "Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt", "Mail de résiliation");
     $this->const[4] = array("ADHERENT_MAIL_VALID", "texte", "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n", "Mail de validation");
     $this->const[5] = array("ADHERENT_MAIL_VALID_SUBJECT", "chaine", "Votre adhésion a été validée", "Sujet du mail de validation");
     $this->const[6] = array("ADHERENT_MAIL_RESIL_SUBJECT", "chaine", "Résiliation de votre adhésion", "Sujet du mail de résiliation");
     $this->const[21] = array("ADHERENT_MAIL_FROM", "chaine", "", "From des mails");
     $this->const[22] = array("ADHERENT_MAIL_COTIS", "texte", "Bonjour %PRENOM%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée", "Mail de validation de cotisation");
     $this->const[23] = array("ADHERENT_MAIL_COTIS_SUBJECT", "chaine", "Reçu de votre cotisation", "Sujet du mail de validation de cotisation");
     $this->const[25] = array("ADHERENT_CARD_HEADER_TEXT", "chaine", "%ANNEE%", "Texte imprimé sur le haut de la carte adhérent");
     $this->const[26] = array("ADHERENT_CARD_FOOTER_TEXT", "chaine", "Association AZERTY", "Texte imprimé sur le bas de la carte adhérent");
     $this->const[27] = array("ADHERENT_CARD_TEXT", "texte", "%FULLNAME%\r\nID: %ID%\r\n%EMAIL%\r\n%ADDRESS%\r\n%ZIP% %TOWN%\r\n%COUNTRY%", "Text to print on member cards");
     $this->const[28] = array("ADHERENT_MAILMAN_ADMINPW", "chaine", "", "Mot de passe Admin des liste mailman");
     $this->const[31] = array("ADHERENT_BANK_USE_AUTO", "yesno", "", "Insertion automatique des cotisations dans le compte banquaire");
     $this->const[32] = array("ADHERENT_BANK_ACCOUNT", "chaine", "", "ID du Compte banquaire utilise");
     $this->const[33] = array("ADHERENT_BANK_CATEGORIE", "chaine", "", "ID de la catégorie banquaire des cotisations");
     $this->const[34] = array("ADHERENT_ETIQUETTE_TYPE", "chaine", "L7163", "Type of address sheets");
     $this->const[35] = array("ADHERENT_ETIQUETTE_TEXT", 'texte', "%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%", "Text to print on member address sheets");
     // Boxes
     //-------
     $this->boxes = array();
     $r = 0;
     $this->boxes[$r][1] = "box_members.php";
     // Permissions
     //------------
     $this->rights = array();
     $this->rights_class = 'adherent';
     $r = 0;
     //$this->rights[$r]->id = 121; // id de la permission
     //$this->rights[$r]->desc = 'Lire les societes'; // libelle de la permission
     //$this->rights[$r]->default = true;
     //$this->rights[$r]->perm = array('lire');
     $this->rights[$r]->id = 71;
     $this->rights[$r]->desc = 'Read members\' card';
     $this->rights[$r]->default = 1;
     $this->rights[$r]->perm = array('lire');
     $r++;
     $this->rights[$r]->id = 72;
     $this->rights[$r]->desc = 'Create/modify members (need also user module permissions if member linked to a user)';
     $this->rights[$r]->default = 0;
     $this->rights[$r]->perm = array('creer');
     $r++;
     $this->rights[$r]->id = 74;
     $this->rights[$r]->desc = 'Remove members';
     $this->rights[$r]->default = 0;
     $this->rights[$r]->perm = array('supprimer');
     $r++;
     $this->rights[$r]->id = 76;
     $this->rights[$r]->desc = 'Export members';
     $this->rights[$r]->default = 0;
     $this->rights[$r]->perm = array('export');
     $r++;
     $this->rights[$r]->id = 75;
     $this->rights[$r]->desc = 'Setup types and attributes of members';
     $this->rights[$r]->default = 0;
     $this->rights[$r]->perm = array('configurer');
     $r++;
     $this->rights[$r]->id = 78;
     $this->rights[$r]->desc = 'Read subscriptions';
     $this->rights[$r]->default = 1;
     $this->rights[$r]->perm = array('cotisation', 'lire');
     $r++;
     $this->rights[$r]->id = 79;
     $this->rights[$r]->desc = 'Create/modify/remove subscriptions';
     $this->rights[$r]->default = 0;
     $this->rights[$r]->perm = array('cotisation', 'creer');
     // Menu
     //--------
     $r = 0;
     $this->menus[$r]->_id = "menu:members";
     $this->menus[$r]->type = "top";
     $this->menus[$r]->position = 15;
     $this->menus[$r]->url = "/adherent/index.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 = "Members";
     $r++;
     $this->menus[$r]->_id = "menu:members0";
     $this->menus[$r]->position = 0;
     $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 = "Members";
     $this->menus[$r]->fk_menu = "menu:members";
     $r++;
     $this->menus[$r]->_id = "menu:subscriptions";
     $this->menus[$r]->position = 1;
     $this->menus[$r]->url = "/adherent/index.php";
     $this->menus[$r]->langs = "compta";
     $this->menus[$r]->perms = '$user->rights->adherent->cotisation->lire';
     $this->menus[$r]->enabled = '$conf->adherent->enabled';
     $this->menus[$r]->usertype = 2;
     $this->menus[$r]->title = "Subscriptions";
     $this->menus[$r]->fk_menu = "menu:members";
     $r++;
     $this->menus[$r]->_id = "menu:subscriptionslist";
     $this->menus[$r]->position = 1;
     $this->menus[$r]->url = "/adherent/cotisations.php";
     $this->menus[$r]->langs = "compta";
     $this->menus[$r]->perms = '$user->rights->adherent->cotisation->lire';
     $this->menus[$r]->enabled = '$conf->adherent->enabled';
     $this->menus[$r]->usertype = 2;
     $this->menus[$r]->title = "List";
     $this->menus[$r]->fk_menu = "menu:subscriptions";
     $r++;
     $this->menus[$r]->_id = "menu:memberscategoriesshort";
     $this->menus[$r]->position = 3;
     $this->menus[$r]->url = "/categories/index.php?type=3";
     $this->menus[$r]->langs = "categories";
     $this->menus[$r]->perms = '$user->rights->categorie->lire';
     $this->menus[$r]->enabled = '$conf->adherent->enabled && $conf->categorie->enabled';
     $this->menus[$r]->usertype = 2;
     $this->menus[$r]->title = "MembersCategoriesShort";
     $this->menus[$r]->fk_menu = "menu:members";
     $r++;
     $this->menus[$r]->_id = "menu:memberstypes";
     $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' => '*****@*****.**', '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
0
     $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);
コード例 #16
0
ファイル: box_activity.php プロジェクト: Samara94/dolibarr
 /**
  *  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;
     include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
     include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $totalMnt = 0;
     $totalnb = 0;
     $line = 0;
     $cachetime = 3600;
     $fileid = '-e' . $conf->entity . '-u' . $user->id . '-s' . $user->societe_id . '-r' . ($user->rights->societe->client->voir ? '1' : '0') . '.cache';
     $now = dol_now();
     $nbofyears = 2;
     if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) {
         $nbofyears = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
     }
     $textHead = $langs->trans("Activity") . ' - ' . $langs->trans("LastXMonthRolling", $nbofyears * 12);
     $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");
     $cumuldata = array();
     // 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);
         $cachedir = DOL_DATA_ROOT . '/facture/temp';
         $filename = '/boxactivity-invoice' . $fileid;
         $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
         $data = array();
         if ($refresh) {
             $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 = "******" 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);
                 $j = 0;
                 while ($j < $num) {
                     $data[$j] = $db->fetch_object($result);
                     $j++;
                 }
                 if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
                     dol_filecache($cachedir, $filename, $data);
                 }
                 $db->free($result);
             } else {
                 dol_print_error($db);
             }
         } else {
             $data = dol_readcachefile($cachedir, $filename);
         }
         $cumuldata = array_merge($cumuldata, $data);
         if (!empty($data)) {
             $j = 0;
             while ($line < count($cumuldata)) {
                 $billurl = "viewstatut=2&amp;paye=1&amp;year=" . $data[$j]->annee;
                 $this->info_box_contents[$line][0] = array('td' => 'align="left" width="16"', 'tooltip' => $langs->trans('Bills') . '&nbsp;' . $facturestatic->LibStatut(1, $data[$j]->fk_statut, 0), 'url' => DOL_URL_ROOT . "/compta/facture/list.php?" . $billurl . "&amp;mainmenu=accountancy&amp;leftmenu=customers_bills", 'logo' => 'bill');
                 $this->info_box_contents[$line][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills") . "&nbsp;" . $facturestatic->LibStatut(1, $data[$j]->fk_statut, 0) . " " . $data[$j]->annee);
                 $this->info_box_contents[$line][2] = array('td' => 'align="right"', 'tooltip' => $langs->trans('Bills') . '&nbsp;' . $facturestatic->LibStatut(1, $data[$j]->fk_statut, 0), 'text' => $data[$j]->nb, 'url' => DOL_URL_ROOT . "/compta/facture/list.php?" . $billurl . "&amp;mainmenu=accountancy&amp;leftmenu=customers_bills");
                 $this->info_box_contents[$line][3] = array('td' => 'align="right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency));
                 // We add only for the current year
                 if ($data[$j]->annee == date("Y")) {
                     $totalnb += $data[$j]->nb;
                     $totalMnt += $data[$j]->Mnttot;
                 }
                 $this->info_box_contents[$line][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(1, $data[$j]->fk_statut, 3));
                 $line++;
                 $j++;
             }
             if (count($data) == 0) {
                 $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedInvoices"));
             }
         }
         $cachedir = DOL_DATA_ROOT . '/facture/temp';
         $filename = '/boxactivity-invoice2' . $fileid;
         $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
         if ($refresh) {
             $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);
                 $j = 0;
                 while ($j < $num) {
                     $data[$j] = $db->fetch_object($result);
                     $j++;
                 }
                 if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
                     dol_filecache($cachedir, $filename, $data);
                 }
                 $db->free($result);
             } else {
                 dol_print_error($db);
             }
         } else {
             $data = dol_readcachefile($cachedir, $filename);
         }
         $cumuldata = array_merge($cumuldata, $data);
         if (!empty($data)) {
             $j = 0;
             while ($line < count($cumuldata)) {
                 $billurl = "viewstatut=" . $data[$j]->fk_statut . "&amp;paye=0";
                 $this->info_box_contents[$line][0] = array('td' => 'align="left" width="16"', 'tooltip' => $langs->trans('Bills') . '&nbsp;' . $facturestatic->LibStatut(0, $data[$j]->fk_statut, 0), 'url' => DOL_URL_ROOT . "/compta/facture/list.php?" . $billurl . "&amp;mainmenu=accountancy&amp;leftmenu=customers_bills", 'logo' => 'bill');
                 $this->info_box_contents[$line][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills") . "&nbsp;" . $facturestatic->LibStatut(0, $data[$j]->fk_statut, 0));
                 $this->info_box_contents[$line][2] = array('td' => 'align="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans('Bills') . '&nbsp;' . $facturestatic->LibStatut(0, $data[$j]->fk_statut, 0), 'url' => DOL_URL_ROOT . "/compta/facture/list.php?" . $billurl . "&amp;mainmenu=accountancy&amp;leftmenu=customers_bills");
                 $totalnb += $data[$j]->nb;
                 $this->info_box_contents[$line][3] = array('td' => 'align="right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency));
                 $totalMnt += $objp->Mnttot;
                 $this->info_box_contents[$line][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(0, $data[$j]->fk_statut, 3));
                 $line++;
                 $j++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$line][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';
         $commandestatic = new Commande($db);
         $cachedir = DOL_DATA_ROOT . '/commande/temp';
         $filename = '/boxactivity-order' . $fileid;
         $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
         $data = array();
         if ($refresh) {
             $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
             $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande as c";
             if (!$user->rights->societe->client->voir && !$user->societe_id) {
                 $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
             }
             $sql .= ")";
             $sql .= " WHERE c.entity = " . $conf->entity;
             $sql .= " AND c.fk_soc = s.rowid";
             if (!$user->rights->societe->client->voir && !$user->societe_id) {
                 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
             }
             $sql .= " AND c.date_commande >= '" . $db->idate($tmpdate) . "'";
             $sql .= " AND c.facture=0";
             $sql .= " GROUP BY c.fk_statut";
             $sql .= " ORDER BY c.fk_statut DESC";
             $result = $db->query($sql);
             if ($result) {
                 $num = $db->num_rows($result);
                 $j = 0;
                 while ($j < $num) {
                     $data[$j] = $db->fetch_object($result);
                     $j++;
                 }
                 if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
                     dol_filecache($cachedir, $filename, $data);
                 }
                 $db->free($result);
             } else {
                 dol_print_error($db);
             }
         } else {
             $data = dol_readcachefile($cachedir, $filename);
         }
         $cumuldata = array_merge($cumuldata, $data);
         if (!empty($data)) {
             $j = 0;
             while ($line < count($cumuldata)) {
                 $this->info_box_contents[$line][0] = array('td' => 'align="left" width="16"', 'url' => DOL_URL_ROOT . "/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=" . $data[$j]->fk_statut, 'tooltip' => $langs->trans("Orders") . "&nbsp;" . $commandestatic->LibStatut($data[$j]->fk_statut, 0, 0), 'logo' => 'object_order');
                 $this->info_box_contents[$line][1] = array('td' => 'align="left"', 'text' => $langs->trans("Orders") . "&nbsp;" . $commandestatic->LibStatut($data[$j]->fk_statut, 0, 0));
                 $this->info_box_contents[$line][2] = array('td' => 'align="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Orders") . "&nbsp;" . $commandestatic->LibStatut($data[$j]->fk_statut, 0, 0), 'url' => DOL_URL_ROOT . "/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=" . $data[$j]->fk_statut);
                 $totalnb += $data[$j]->nb;
                 $this->info_box_contents[$line][3] = array('td' => 'align="right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency));
                 $totalMnt += $data[$j]->Mnttot;
                 $this->info_box_contents[$line][4] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($data[$j]->fk_statut, 0, 3));
                 $line++;
                 $j++;
             }
         }
     }
     // list the summary of the propals
     if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
         include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
         $propalstatic = new Propal($db);
         $cachedir = DOL_DATA_ROOT . '/propale/temp';
         $filename = '/boxactivity-propal' . $fileid;
         $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
         $data = array();
         if ($refresh) {
             $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
             $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as p";
             if (!$user->rights->societe->client->voir && !$user->societe_id) {
                 $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
             }
             $sql .= ")";
             $sql .= " WHERE p.entity = " . $conf->entity;
             $sql .= " AND p.fk_soc = s.rowid";
             if (!$user->rights->societe->client->voir && !$user->societe_id) {
                 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
             }
             $sql .= " AND p.datep >= '" . $db->idate($tmpdate) . "'";
             $sql .= " AND p.date_cloture IS NULL";
             // just unclosed
             $sql .= " GROUP BY p.fk_statut";
             $sql .= " ORDER BY p.fk_statut DESC";
             $result = $db->query($sql);
             if ($result) {
                 $num = $db->num_rows($result);
                 $j = 0;
                 while ($j < $num) {
                     $data[$j] = $db->fetch_object($result);
                     $j++;
                 }
                 if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
                     dol_filecache($cachedir, $filename, $data);
                 }
                 $db->free($result);
             } else {
                 dol_print_error($db);
             }
         } else {
             $data = dol_readcachefile($cachedir, $filename);
         }
         $cumuldata = array_merge($cumuldata, $data);
         if (!empty($data)) {
             $j = 0;
             while ($line < count($cumuldata)) {
                 $this->info_box_contents[$line][0] = array('td' => 'align="left" width="16"', 'url' => DOL_URL_ROOT . "/comm/propal/list.php?mainmenu=commercial&amp;leftmenu=propals&amp;viewstatut=" . $data[$j]->fk_statut, 'tooltip' => $langs->trans("Proposals") . "&nbsp;" . $propalstatic->LibStatut($data[$j]->fk_statut, 0), 'logo' => 'object_propal');
                 $this->info_box_contents[$line][1] = array('td' => 'align="left"', 'text' => $langs->trans("Proposals") . "&nbsp;" . $propalstatic->LibStatut($data[$j]->fk_statut, 0));
                 $this->info_box_contents[$line][2] = array('td' => 'align="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals") . "&nbsp;" . $propalstatic->LibStatut($data[$j]->fk_statut, 0), 'url' => DOL_URL_ROOT . "/comm/propal/list.php?mainmenu=commercial&amp;leftmenu=propals&amp;viewstatut=" . $data[$j]->fk_statut);
                 $totalnb += $data[$j]->nb;
                 $this->info_box_contents[$line][3] = array('td' => 'align="right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency));
                 $totalMnt += $data[$j]->Mnttot;
                 $this->info_box_contents[$line][4] = array('td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($data[$j]->fk_statut, 3));
                 $line++;
                 $j++;
             }
         }
     }
     // Add the sum in the bottom of the boxes
     $this->info_box_contents[$line][0] = array('tr' => 'class="liste_total"');
     $this->info_box_contents[$line][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total") . "&nbsp;" . $textHead);
     $this->info_box_contents[$line][2] = array('td' => 'align="right" class="liste_total" ', 'text' => $totalnb);
     $this->info_box_contents[$line][3] = array('td' => 'align="right" class="liste_total" ', 'text' => '');
     $this->info_box_contents[$line][4] = array('td' => 'align="right" class="liste_total" ', 'text' => "");
 }
コード例 #17
0
ファイル: xcal.lib.php プロジェクト: nrjacker4/crm-php
/**
 *	Build a file from an array of events
 *  All input params and data must be encoded in $conf->charset_output
 *
 *	@param		string	$format				'vcal' or 'ical'
 *	@param		string	$title				Title of export
 *	@param		string	$desc				Description of export
 *	@param		array	$events_array		Array of events ('eid','startdate','duration','enddate','title','summary','category','email','url','desc','author')
 *	@param		string	$outputfile			Output file
 *	@return		int							<0 if ko, Nb of events in file if ok
 */
function build_calfile($format, $title, $desc, $events_array, $outputfile)
{
    global $conf, $langs;
    dol_syslog("xcal.lib.php::build_calfile Build cal file " . $outputfile . " to format " . $format);
    if (empty($outputfile)) {
        return -1;
    }
    // Note: A cal file is an UTF8 encoded file
    $calfileh = fopen($outputfile, 'w');
    if ($calfileh) {
        include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
        $now = dol_now();
        $encoding = '';
        if ($format == 'vcal') {
            $encoding = 'ENCODING=QUOTED-PRINTABLE:';
        }
        // Print header
        fwrite($calfileh, "BEGIN:VCALENDAR\n");
        fwrite($calfileh, "VERSION:2.0\n");
        fwrite($calfileh, "METHOD:PUBLISH\n");
        //fwrite($calfileh,"PRODID:-//DOLIBARR ".DOL_VERSION."//EN\n");
        fwrite($calfileh, "PRODID:-//DOLIBARR " . DOL_VERSION . "\n");
        fwrite($calfileh, "CALSCALE:GREGORIAN\n");
        fwrite($calfileh, "X-WR-CALNAME:" . $encoding . format_cal($format, $title) . "\n");
        fwrite($calfileh, "X-WR-CALDESC:" . $encoding . format_cal($format, $desc) . "\n");
        $hh = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, 'hour');
        $mm = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, 'min');
        $ss = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, 'sec');
        //fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
        if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE) && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60) {
            fwrite($calfileh, "X-PUBLISHED-TTL: P" . $hh . "H" . $mm . "M" . $ss . "S\n");
        }
        foreach ($events_array as $date => $event) {
            $eventqualified = true;
            if ($eventqualified) {
                // See http://fr.wikipedia.org/wiki/ICalendar for format
                // See http://www.ietf.org/rfc/rfc2445.txt for RFC
                $uid = $event['uid'];
                $type = $event['type'];
                $startdate = $event['startdate'];
                $duration = $event['duration'];
                $enddate = $event['enddate'];
                $summary = $event['summary'];
                $category = $event['category'];
                $priority = $event['priority'];
                $fulldayevent = $event['fulldayevent'];
                $location = $event['location'];
                $email = $event['email'];
                $url = $event['url'];
                $transparency = $event['transparency'];
                // OPAQUE (busy) or TRANSPARENT (not busy)
                $description = preg_replace('/<br[\\s\\/]?>/i', "\n", $event['desc']);
                $description = dol_string_nohtmltag($description, 0);
                // Remove html tags
                $created = $event['created'];
                $modified = $event['modified'];
                // Uncomment for tests
                //$summary="Resume";
                //$description="Description";
                //$description="MemberValidatedInDolibarr gd gdf gd gdff\nNom: tgdf g dfgdf gfd r ter\nType: gdfgfdf dfg fd gfd gd gdf gdf gfd gdfg dfg ddf\nAuteur: AD01fg dgdgdfg df gdf gd";
                // Format
                $summary = format_cal($format, $summary);
                $description = format_cal($format, $description);
                $category = format_cal($format, $category);
                $location = format_cal($format, $location);
                // Output the vCard/iCal VEVENT object
                /*
                				Example from Google ical export for a 1 hour event:
                BEGIN:VEVENT
                DTSTART:20101103T120000Z
                DTEND:20101103T130000Z
                DTSTAMP:20101121T144902Z
                UID:4eilllcsq8r1p87ncg7vc8dbpk@google.com
                CREATED:20101121T144657Z
                DESCRIPTION:
                LAST-MODIFIED:20101121T144707Z
                LOCATION:
                SEQUENCE:0
                STATUS:CONFIRMED
                SUMMARY:Tache 1 heure
                TRANSP:OPAQUE
                END:VEVENT
                
                Example from Google ical export for a 1 day event:
                BEGIN:VEVENT
                DTSTART;VALUE=DATE:20101102
                DTEND;VALUE=DATE:20101103
                DTSTAMP:20101121T144902Z
                UID:d09t43kcf1qgapu9efsmmo1m6k@google.com
                CREATED:20101121T144607Z
                DESCRIPTION:
                LAST-MODIFIED:20101121T144607Z
                LOCATION:
                SEQUENCE:0
                STATUS:CONFIRMED
                SUMMARY:Tache 1 jour
                TRANSP:TRANSPARENT
                END:VEVENT
                */
                if ($type == 'event') {
                    fwrite($calfileh, "BEGIN:VEVENT\n");
                    fwrite($calfileh, "UID:" . $uid . "\n");
                    if (!empty($email)) {
                        fwrite($calfileh, "ORGANIZER:MAILTO:" . $email . "\n");
                        fwrite($calfileh, "CONTACT:MAILTO:" . $email . "\n");
                    }
                    if (!empty($url)) {
                        fwrite($calfileh, "URL:" . $url . "\n");
                    }
                    if ($created) {
                        fwrite($calfileh, "CREATED:" . dol_print_date($created, 'dayhourxcard', true) . "\n");
                    }
                    if ($modified) {
                        fwrite($calfileh, "LAST-MODIFIED:" . dol_print_date($modified, 'dayhourxcard', true) . "\n");
                    }
                    fwrite($calfileh, "SUMMARY:" . $encoding . $summary . "\n");
                    fwrite($calfileh, "DESCRIPTION:" . $encoding . $description . "\n");
                    /* Other keys:
                    			// Status values for a "VEVENT"
                    			statvalue  = "TENTATIVE"           ;Indicates event is
                    		                                        ;tentative.
                    		                / "CONFIRMED"           ;Indicates event is
                    		                                        ;definite.
                    		                / "CANCELLED"           ;Indicates event was
                                      // Status values for "VTODO".
                                      statvalue  =/ "NEEDS-ACTION"       ;Indicates to-do needs action.
                    		                / "COMPLETED"           ;Indicates to-do completed.
                    		                / "IN-PROCESS"          ;Indicates to-do in process of
                    		                / "CANCELLED"           ;Indicates to-do was cancelled.
                                      // Status values for "VJOURNAL".
                    		    statvalue  =/ "DRAFT"              ;Indicates journal is draft.
                    		                / "FINAL"               ;Indicates journal is final.
                    		                / "CANCELLED"           ;Indicates journal is removed.
                    			*/
                    //fwrite($calfileh,"CLASS:PUBLIC\n");				// PUBLIC, PRIVATE, CONFIDENTIAL
                    //fwrite($calfileh,"X-MICROSOFT-CDO-BUSYSTATUS:1\n");
                    //ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Laurent Destailleur;X-NUM-GUESTS=0:mailto:eldy10@gmail.com
                    if (!empty($location)) {
                        fwrite($calfileh, "LOCATION:" . $encoding . $location . "\n");
                    }
                    if ($fulldayevent) {
                        fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n");
                    }
                    if ($fulldayevent) {
                        fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:1\n");
                    }
                    // Date must be GMT dates
                    // Current date
                    fwrite($calfileh, "DTSTAMP:" . dol_print_date($now, 'dayhourxcard', true) . "\n");
                    // Start date
                    $prefix = '';
                    $startdatef = dol_print_date($startdate, 'dayhourxcard', true);
                    if ($fulldayevent) {
                        $prefix = ';VALUE=DATE';
                        $startdatef = dol_print_date($startdate, 'dayxcard', false);
                        // Local time
                    }
                    fwrite($calfileh, "DTSTART" . $prefix . ":" . $startdatef . "\n");
                    // End date
                    if ($fulldayevent) {
                        if (empty($enddate)) {
                            $enddate = dol_time_plus_duree($startdate, 1, 'd');
                        }
                    } else {
                        if (empty($enddate)) {
                            $enddate = $startdate + $duration;
                        }
                    }
                    $prefix = '';
                    $enddatef = dol_print_date($enddate, 'dayhourxcard', true);
                    if ($fulldayevent) {
                        $prefix = ';VALUE=DATE';
                        $enddatef = dol_print_date($enddate + 1, 'dayxcard', false);
                        //$enddatef .= dol_print_date($enddate+1,'dayhourxcard',false);   // Local time
                    }
                    fwrite($calfileh, "DTEND" . $prefix . ":" . $enddatef . "\n");
                    fwrite($calfileh, 'STATUS:CONFIRMED' . "\n");
                    if (!empty($transparency)) {
                        fwrite($calfileh, "TRANSP:" . $transparency . "\n");
                    }
                    if (!empty($category)) {
                        fwrite($calfileh, "CATEGORIES:" . $encoding . $category . "\n");
                    }
                    fwrite($calfileh, "END:VEVENT\n");
                }
                // Output the vCard/iCal VTODO object
                // ...
                //PERCENT-COMPLETE:39
                // Output the vCard/iCal VJOURNAL object
                if ($type == 'journal') {
                    fwrite($calfileh, "BEGIN:VJOURNAL\n");
                    fwrite($calfileh, "UID:" . $uid . "\n");
                    if (!empty($email)) {
                        fwrite($calfileh, "ORGANIZER:MAILTO:" . $email . "\n");
                        fwrite($calfileh, "CONTACT:MAILTO:" . $email . "\n");
                    }
                    if (!empty($url)) {
                        fwrite($calfileh, "URL:" . $url . "\n");
                    }
                    if ($created) {
                        fwrite($calfileh, "CREATED:" . dol_print_date($created, 'dayhourxcard', true) . "\n");
                    }
                    if ($modified) {
                        fwrite($calfileh, "LAST-MODIFIED:" . dol_print_date($modified, 'dayhourxcard', true) . "\n");
                    }
                    fwrite($calfileh, "SUMMARY:" . $encoding . $summary . "\n");
                    fwrite($calfileh, "DESCRIPTION:" . $encoding . $description . "\n");
                    fwrite($calfileh, 'STATUS:CONFIRMED' . "\n");
                    fwrite($calfileh, "CATEGORIES:" . $category . "\n");
                    fwrite($calfileh, "LOCATION:" . $location . "\n");
                    fwrite($calfileh, "TRANSP:OPAQUE\n");
                    fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
                    fwrite($calfileh, "DTSTAMP:" . dol_print_date($startdatef, 'dayhourxcard', true) . "\n");
                    fwrite($calfileh, "END:VJOURNAL\n");
                }
                // Put other info in comment
                /*
                $comment=array();
                $comment ['eid']			= $eid;
                $comment ['url']			= $linktoevent;
                $comment ['date']			= dol_mktime($evttime,"Ymd");
                $comment ['duration']		= $duration;
                $comment ['startdate']		= $startdate;
                $comment ['enddate']		= $enddate;
                fwrite($calfileh,"COMMENT:" . serialize ($comment) . "\n");
                */
            }
        }
        // Footer
        fwrite($calfileh, "END:VCALENDAR");
        fclose($calfileh);
        if (!empty($conf->global->MAIN_UMASK)) {
            @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
        }
    } else {
        dol_syslog("xcal.lib.php::build_calfile Failed to open file " . $outputfile . " for writing");
        return -2;
    }
}
コード例 #18
0
ファイル: card.php プロジェクト: BebZ/lead
 print '</tr>';
 print '<tr>';
 print '<td class="fieldrequired"  width="20%">';
 print $langs->trans('LeadAmountGuess');
 print '</td>';
 print '<td>';
 print '<input type="text" name="amount_guess" size="5" value="' . price2num($amount_guess) . '"/>';
 print '</td>';
 print '</tr>';
 print '<tr>';
 print '<td class="fieldrequired"  width="20%">';
 print $langs->trans('LeadDeadLine');
 print '</td>';
 print '<td>';
 if (strlen($deadline) == 0) {
     $deadline = dol_time_plus_duree(dol_now(), $conf->global->LEAD_NB_DAY_COSURE_AUTO, 'd');
 }
 print $form->select_date($deadline, 'deadline', 0, 0, 0, "addlead", 1, 1, 0, 0);
 print '</td>';
 print '</tr>';
 print '<tr>';
 print '<td>';
 print $langs->trans('LeadDescription');
 print '</td>';
 print '<td>';
 $doleditor = new DolEditor('description', $object->description, '', 160, 'dolibarr_notes', 'In', true, false, $conf->global->FCKEDITOR_ENABLE || $conf->global->FCKEDITOR_ENABLE_SOCIETE, 4, 90);
 $doleditor->Create();
 print '</td>';
 print '</tr>';
 // Other attributes
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
コード例 #19
0
 /**
  *   Constructor. Define names, constants, directories, boxes, permissions
  *
  *   @param      DoliDB		$db      Database handler
  */
 function __construct($db)
 {
     global $conf;
     $this->db = $db;
     $this->numero = 310;
     $this->family = "hr";
     $this->module_position = 20;
     // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
     $this->name = preg_replace('/^mod/i', '', get_class($this));
     $this->description = "Management of members of a foundation or association";
     $this->version = 'dolibarr';
     // 'experimental' or 'dolibarr' or version
     $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
     $this->special = 0;
     $this->picto = 'user';
     // Data directories to create when module is enabled
     $this->dirs = array("/adherent/temp");
     // Config pages
     //-------------
     $this->config_page_url = array("adherent.php@adherents");
     // Dependencies
     //------------
     $this->depends = array();
     $this->requiredby = array('modMailmanSpip');
     $this->langfiles = array("members", "companies");
     // Constants
     //-----------
     $this->const = array();
     $r = 0;
     $this->const[$r][0] = "ADHERENT_MAIL_RESIL";
     $this->const[$r][1] = "texte";
     $this->const[$r][2] = "Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt";
     $this->const[$r][3] = "Mail de résiliation";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAIL_VALID";
     $this->const[$r][1] = "texte";
     $this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n";
     $this->const[$r][3] = "Mail de validation";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAIL_VALID_SUBJECT";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "Votre adhésion a été validée";
     $this->const[$r][3] = "Sujet du mail de validation";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAIL_RESIL_SUBJECT";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "Résiliation de votre adhésion";
     $this->const[$r][3] = "Sujet du mail de résiliation";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAIL_FROM";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "";
     $this->const[$r][3] = "From des mails";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAIL_COTIS";
     $this->const[$r][1] = "texte";
     $this->const[$r][2] = "Bonjour %FIRSTNAME%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée";
     $this->const[$r][3] = "Mail de validation de cotisation";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAIL_COTIS_SUBJECT";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "Reçu de votre cotisation";
     $this->const[$r][3] = "Sujet du mail de validation de cotisation";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_CARD_HEADER_TEXT";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "%YEAR%";
     $this->const[$r][3] = "Texte imprimé sur le haut de la carte adhérent";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_CARD_FOOTER_TEXT";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "%COMPANY%";
     $this->const[$r][3] = "Texte imprimé sur le bas de la carte adhérent";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_CARD_TEXT";
     $this->const[$r][1] = "texte";
     $this->const[$r][2] = "%FULLNAME%\r\nID: %ID%\r\n%EMAIL%\r\n%ADDRESS%\r\n%ZIP% %TOWN%\r\n%COUNTRY%";
     $this->const[$r][3] = "Text to print on member cards";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_MAILMAN_ADMINPW";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "";
     $this->const[$r][3] = "Mot de passe Admin des liste mailman";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_BANK_USE_AUTO";
     $this->const[$r][1] = "yesno";
     $this->const[$r][2] = "";
     $this->const[$r][3] = "Insertion automatique des cotisations dans le compte banquaire";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_BANK_ACCOUNT";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "";
     $this->const[$r][3] = "ID du Compte banquaire utilise";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_BANK_CATEGORIE";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "";
     $this->const[$r][3] = "ID de la catégorie banquaire des cotisations";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_ETIQUETTE_TYPE";
     $this->const[$r][1] = "chaine";
     $this->const[$r][2] = "L7163";
     $this->const[$r][3] = "Type of address sheets";
     $this->const[$r][4] = 0;
     $r++;
     $this->const[$r][0] = "ADHERENT_ETIQUETTE_TEXT";
     $this->const[$r][1] = "texte";
     $this->const[$r][2] = "%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%";
     $this->const[$r][3] = "Text to print on member address sheets";
     $this->const[$r][4] = 0;
     $r++;
     // Boxes
     //-------
     $this->boxes = array(0 => array('file' => 'box_members.php', 'enabledbydefaulton' => 'Home'));
     // Permissions
     //------------
     $this->rights = array();
     $this->rights_class = 'adherent';
     $r = 0;
     // $this->rights[$r][0]     Id permission (unique tous modules confondus)
     // $this->rights[$r][1]     Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
     // $this->rights[$r][2]     Non utilise
     // $this->rights[$r][3]     1=Permis par defaut, 0=Non permis par defaut
     // $this->rights[$r][4]     Niveau 1 pour nommer permission dans code
     // $this->rights[$r][5]     Niveau 2 pour nommer permission dans code
     $r++;
     $this->rights[$r][0] = 71;
     $this->rights[$r][1] = 'Read members\' card';
     $this->rights[$r][2] = 'r';
     $this->rights[$r][3] = 1;
     $this->rights[$r][4] = 'lire';
     $r++;
     $this->rights[$r][0] = 72;
     $this->rights[$r][1] = 'Create/modify members (need also user module permissions if member linked to a user)';
     $this->rights[$r][2] = 'w';
     $this->rights[$r][3] = 0;
     $this->rights[$r][4] = 'creer';
     $r++;
     $this->rights[$r][0] = 74;
     $this->rights[$r][1] = 'Remove members';
     $this->rights[$r][2] = 'd';
     $this->rights[$r][3] = 0;
     $this->rights[$r][4] = 'supprimer';
     $r++;
     $this->rights[$r][0] = 76;
     $this->rights[$r][1] = 'Export members';
     $this->rights[$r][2] = 'r';
     $this->rights[$r][3] = 0;
     $this->rights[$r][4] = 'export';
     $r++;
     $this->rights[$r][0] = 75;
     $this->rights[$r][1] = 'Setup types of membership';
     $this->rights[$r][2] = 'w';
     $this->rights[$r][3] = 0;
     $this->rights[$r][4] = 'configurer';
     $r++;
     $this->rights[$r][0] = 78;
     $this->rights[$r][1] = 'Read subscriptions';
     $this->rights[$r][2] = 'r';
     $this->rights[$r][3] = 1;
     $this->rights[$r][4] = 'cotisation';
     $this->rights[$r][5] = 'lire';
     $r++;
     $this->rights[$r][0] = 79;
     $this->rights[$r][1] = 'Create/modify/remove subscriptions';
     $this->rights[$r][2] = 'w';
     $this->rights[$r][3] = 0;
     $this->rights[$r][4] = 'cotisation';
     $this->rights[$r][5] = 'creer';
     // 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.civility' => "UserTitle", 'a.lastname' => "Lastname", 'a.firstname' => "Firstname", 'a.login' => "Login", 'a.morphy' => 'Nature', 'a.societe' => 'Company', 'a.address' => "Address", 'a.zip' => "Zip", 'a.town' => "Town", 'd.nom' => "State", 'co.code' => "CountryCode", 'co.label' => "Country", 'a.phone' => "PhonePro", 'a.phone_perso' => "PhonePerso", 'a.phone_mobile' => "PhoneMobile", 'a.email' => "Email", 'a.birth' => "Birthday", 'a.statut' => "Status", 'a.photo' => "Photo", 'a.note_public' => "NotePublic", 'a.note_private' => "NotePrivate", '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_TypeFields_array[$r] = array('a.civility' => "Text", 'a.lastname' => "Text", 'a.firstname' => "Text", 'a.login' => "Text", 'a.morphy' => 'Text', 'a.societe' => 'Text', 'a.address' => "Text", 'a.zip' => "Text", 'a.town' => "Text", 'd.nom' => "Text", 'co.code' => 'Text', 'co.label' => "Text", 'a.phone' => "Text", 'a.phone_perso' => "Text", 'a.phone_mobile' => "Text", 'a.email' => "Text", 'a.birth' => "Date", 'a.statut' => "Status", 'a.note_public' => "Text", 'a.note_private' => "Text", 'a.datec' => 'Date', 'a.datevalid' => 'Date', 'a.tms' => 'Date', 'a.datefin' => 'Date', 'ta.rowid' => 'List:adherent_type:libelle', 'ta.libelle' => 'Text', 'c.dateadh' => 'Date', 'c.cotisation' => 'Numeric');
     $this->export_entities_array[$r] = array('a.rowid' => 'member', 'a.civility' => "member", 'a.lastname' => "member", 'a.firstname' => "member", 'a.login' => "member", 'a.morphy' => 'member', 'a.societe' => 'member', 'a.address' => "member", 'a.zip' => "member", 'a.town' => "member", 'd.nom' => "member", 'co.code' => "member", 'co.label' => "member", 'a.phone' => "member", 'a.phone_perso' => "member", 'a.phone_mobile' => "member", 'a.email' => "member", 'a.birth' => "member", 'a.statut' => "member", 'a.photo' => "member", 'a.note_public' => "member", 'a.note_private' => "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 = 'adherent' AND entity = " . $conf->entity;
     $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] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_departements as d ON a.state_id = d.rowid';
     $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as co ON a.country = co.rowid';
     $this->export_sql_end[$r] .= ' WHERE a.fk_adherent_type = ta.rowid';
     $this->export_dependencies_array[$r] = array('subscription' => 'c.rowid');
     // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
     // 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.civility' => "UserTitle", 'a.lastname' => "Lastname*", 'a.firstname' => "Firstname", 'a.login' => "Login*", "a.pass" => "Password", "a.fk_adherent_type" => "MemberType*", 'a.morphy' => 'Nature*', 'a.societe' => 'Company', 'a.address' => "Address", 'a.zip' => "Zip", 'a.town' => "Town", 'a.state_id' => 'StateId', 'a.country' => "CountryId", 'a.phone' => "PhonePro", 'a.phone_perso' => "PhonePerso", 'a.phone_mobile' => "PhoneMobile", 'a.email' => "Email", 'a.birth' => "Birthday", 'a.statut' => "Status*", 'a.photo' => "Photo", 'a.note_public' => "NotePublic", 'a.note_private' => "NotePrivate", 'a.datec' => 'DateCreation', 'a.datefin' => 'DateEndSubscription');
     // Add extra fields
     $sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'adherent' AND entity = " . $conf->entity;
     $resql = $this->db->query($sql);
     if ($resql) {
         while ($obj = $this->db->fetch_object($resql)) {
             $fieldname = 'extra.' . $obj->name;
             $fieldlabel = ucfirst($obj->label);
             $this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
         }
     }
     // 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.civility' => 'code@' . MAIN_DB_PREFIX . 'c_civility', '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.civility' => "MR", 'a.lastname' => 'Smith', 'a.firstname' => 'John', 'a.login' => 'jsmith', 'a.pass' => 'passofjsmith', 'a.fk_adherent_type' => '1', 'a.morphy' => '"mor" or "phy"', 'a.societe' => 'JS company', 'a.address' => '21 jump street', 'a.zip' => '55000', 'a.town' => 'New York', 'a.country' => '1', 'a.email' => '*****@*****.**', 'a.birth' => '1972-10-10', 'a.statut' => "0 or 1", 'a.note_public' => "This is a public comment on member", 'a.note_private' => "This is private 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'));
 }
コード例 #20
0
ファイル: project.lib.php プロジェクト: Albertopf/prueba
/**
 * Output a task line into a perday intput mode
 *
 * @param	string	   	$inc					Line number (start to 0, then increased by recursive call)
 * @param	int			$firstdaytoshow			First day to show
 * @param	User|null	$fuser					Restrict list to user if defined
 * @param   string		$parent					Id of parent project to show (0 to show all)
 * @param   Task[]		$lines					Array of lines
 * @param   int			$level					Level (start to 0, then increased/decrease by recursive call)
 * @param   string		$projectsrole			Array of roles user has on project
 * @param   string		$tasksrole				Array of roles user has on task
 * @param	string		$mine					Show only task lines I am assigned to
 * @param   int			$restricteditformytask	0=No restriction, 1=Enable add time only if task is a task i am affected to
 * @return  $inc
 */
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask = 1)
{
    global $db, $user, $bc, $langs;
    global $form, $formother, $projectstatic, $taskstatic;
    $lastprojectid = 0;
    $var = true;
    $numlines = count($lines);
    for ($i = 0; $i < $numlines; $i++) {
        if ($parent == 0) {
            $level = 0;
        }
        if ($lines[$i]->fk_parent == $parent) {
            // Break on a new project
            if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
                $var = !$var;
                $lastprojectid = $lines[$i]->fk_project;
                $projectstatic->id = $lines[$i]->fk_project;
                $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
                // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week
            }
            // If we want all or we have a role on task, we show it
            if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
                print "<tr " . $bc[$var] . ">\n";
                // Project
                print '<td class="nowrap">';
                $projectstatic->id = $lines[$i]->fk_project;
                $projectstatic->ref = $lines[$i]->projectref;
                $projectstatic->title = $lines[$i]->projectlabel;
                $projectstatic->public = $lines[$i]->public;
                print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole") . ': ' . $projectsrole[$lines[$i]->fk_project]);
                print "</td>";
                // Ref
                print '<td class="nowrap">';
                $taskstatic->id = $lines[$i]->id;
                $taskstatic->ref = $lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id;
                print $taskstatic->getNomUrl(1, 'withproject', 'time');
                print '</td>';
                // Label task
                print "<td>";
                print '<!-- Task id = ' . $lines[$i]->id . ' -->';
                for ($k = 0; $k < $level; $k++) {
                    print "&nbsp;&nbsp;&nbsp;";
                }
                $taskstatic->id = $lines[$i]->id;
                $taskstatic->ref = $lines[$i]->label;
                $taskstatic->date_start = $lines[$i]->date_start;
                $taskstatic->date_end = $lines[$i]->date_end;
                print $taskstatic->getNomUrl(0, 'withproject', 'time');
                //print "<br>";
                //for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
                //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
                print "</td>\n";
                // Planned Workload
                print '<td align="right">';
                if ($lines[$i]->planned_workload) {
                    print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
                } else {
                    print '--:--';
                }
                print '</td>';
                // Progress declared %
                print '<td align="right">';
                print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
                print '</td>';
                // Time spent by everybody
                print '<td align="right">';
                // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
                if ($lines[$i]->duration) {
                    print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . '">';
                    print convertSecondToTime($lines[$i]->duration, 'allhourmin');
                    print '</a>';
                } else {
                    print '--:--';
                }
                print "</td>\n";
                // Time spent by user
                print '<td align="right">';
                $tmptimespent = $taskstatic->getSummaryOfTimeSpent();
                if ($tmptimespent['total_duration']) {
                    print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
                } else {
                    print '--:--';
                }
                print "</td>\n";
                $disabledproject = 1;
                $disabledtask = 1;
                //print "x".$lines[$i]->fk_project;
                //var_dump($lines[$i]);
                //var_dump($projectsrole[$lines[$i]->fk_project]);
                // If at least one role for project
                if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
                    $disabledproject = 0;
                    $disabledtask = 0;
                }
                // If $restricteditformytask is on and I have no role on task, i disable edit
                if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
                    $disabledtask = 1;
                }
                //var_dump($projectstatic->weekWorkLoadPerTask);
                // Fields to show current time
                $tableCell = '';
                $modeinput = 'hours';
                for ($idw = 0; $idw < 7; $idw++) {
                    $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
                    $tmparray = dol_getdate($tmpday);
                    $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
                    $alreadyspent = '';
                    if ($dayWorkLoad > 0) {
                        $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin');
                    }
                    $alttitle = $langs->trans("AddHereTimeSpentForDay", $tmparray['day'], $tmparray['mon']);
                    $tableCell = '<td align="center" class="hide' . $idw . '">';
                    if ($alreadyspent) {
                        $tableCell .= '<span class="timesheetalreadyrecorded"><input type="text" class="center smallpadd" size="2" disabled id="timespent[' . $inc . '][' . $idw . ']" name="task[' . $lines[$i]->id . '][' . $idw . ']" value="' . $alreadyspent . '"></span>';
                        //$placeholder=' placeholder="00:00"';
                        $placeholder = '';
                        //$tableCell.='+';
                    }
                    $tableCell .= '<input type="text" alt="' . ($disabledtask ? '' : $alttitle) . '" title="' . ($disabledtask ? '' : $alttitle) . '" ' . ($disabledtask ? 'disabled' : $placeholder) . ' class="center smallpadd" size="2" id="timeadded[' . $inc . '][' . $idw . ']" name="task[' . $lines[$i]->id . '][' . $idw . ']" value="" cols="2"  maxlength="5"';
                    $tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"';
                    $tableCell .= 'onblur="regexEvent(this,event,\'' . $modeinput . '\'); updateTotal(' . $idw . ',\'' . $modeinput . '\')" />';
                    $tableCell .= '</td>';
                    print $tableCell;
                }
                print '<td align="right">';
                if (!$lines[$i]->public && $disabledproject) {
                    print $form->textwithpicto('', $langs->trans("YouAreNotContactOfProject"));
                } else {
                    if ($disabledtask) {
                        print $form->textwithpicto('', $langs->trans("TaskIsNotAffectedToYou"));
                    }
                }
                print '</td>';
                print "</tr>\n";
            }
            $inc++;
            $level++;
            if ($lines[$i]->id) {
                projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
            }
            $level--;
        } else {
            //$level--;
        }
    }
    return $inc;
}
コード例 #21
0
ファイル: adherent.class.php プロジェクト: ripasch/dolibarr
 /**
  *	Fonction qui insere la cotisation dans la base de donnees
  *	et eventuellement liens dans banques, mailman, etc...
  *	@param	    date        	Date d'effet de la cotisation
  *	@param	    montant     	Montant cotisation (accepte 0 pour les adherents non soumis e cotisation)
  *	@param		account_id		Id compte bancaire
  *	@param		operation		Type operation (si Id compte bancaire fourni)
  *	@param		label			Label operation (si Id compte bancaire fourni)
  *	@param		num_chq			Numero cheque (si Id compte bancaire fourni)
  *	@param		emetteur_nom	Nom emetteur cheque
  *	@param		emetteur_banque	Nom banque emetteur cheque
  *	@param		datesubend		Date fin adhesion
  *	@return     int         	rowid de l'entree ajoutee, <0 si erreur
  */
 function cotisation($date, $montant, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
 {
     global $conf, $langs, $user;
     // 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 = $dateop;
             $this->last_subscription_amount = $montant;
             $this->last_subscription_date_start = $date;
             $this->last_subscription_date_end = $datefin;
             $this->use_webcal = $conf->global->PHPWEBCALENDAR_MEMBERSTATUS == 'always' ? 1 : 0;
             // 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->db->commit();
             return $rowid;
         } else {
             $this->db->rollback();
             return -2;
         }
     } else {
         $this->error = $cotisation->error;
         $this->db->rollback();
         return -1;
     }
 }
コード例 #22
0
ファイル: date.lib.php プロジェクト: ADDAdev/Dolibarr
/**
 *	Fonction retournant le nombre de jour feries, samedis et dimanches entre 2 dates entrees en timestamp. Dates must be UTC with hour, day, min to 0
 *	Called by function num_open_day
 *
 *	@param	    int			$timestampStart     Timestamp de debut
 *	@param	    int			$timestampEnd       Timestamp de fin
 *  @param      string		$countrycode        Country code
 *	@return   	int								Nombre de jours feries
 */
function num_public_holiday($timestampStart, $timestampEnd, $countrycode = 'FR')
{
    $nbFerie = 0;
    // Check to ensure we use correct parameters
    if (($timestampEnd - $timestampStart) % 86400 != 0) {
        return 'ErrorDates must use same hours and must be GMT dates';
    }
    $i = 0;
    while ($timestampStart < $timestampEnd && $i < 50000) {
        $ferie = false;
        $countryfound = 0;
        $jour = date("d", $timestampStart);
        $mois = date("m", $timestampStart);
        $annee = date("Y", $timestampStart);
        if ($countrycode == 'FR') {
            $countryfound = 1;
            // Definition des dates feriees fixes
            if ($jour == 1 && $mois == 1) {
                $ferie = true;
            }
            // 1er janvier
            if ($jour == 1 && $mois == 5) {
                $ferie = true;
            }
            // 1er mai
            if ($jour == 8 && $mois == 5) {
                $ferie = true;
            }
            // 5 mai
            if ($jour == 14 && $mois == 7) {
                $ferie = true;
            }
            // 14 juillet
            if ($jour == 15 && $mois == 8) {
                $ferie = true;
            }
            // 15 aout
            if ($jour == 1 && $mois == 11) {
                $ferie = true;
            }
            // 1 novembre
            if ($jour == 11 && $mois == 11) {
                $ferie = true;
            }
            // 11 novembre
            if ($jour == 25 && $mois == 12) {
                $ferie = true;
            }
            // 25 decembre
            // Calcul du jour de paques
            $date_paques = easter_date($annee);
            $jour_paques = date("d", $date_paques);
            $mois_paques = date("m", $date_paques);
            if ($jour_paques == $jour && $mois_paques == $mois) {
                $ferie = true;
            }
            // Paques
            // Calcul du jour de l ascension (38 jours apres Paques)
            $date_ascension = mktime(date("H", $date_paques), date("i", $date_paques), date("s", $date_paques), date("m", $date_paques), date("d", $date_paques) + 38, date("Y", $date_paques));
            $jour_ascension = date("d", $date_ascension);
            $mois_ascension = date("m", $date_ascension);
            if ($jour_ascension == $jour && $mois_ascension == $mois) {
                $ferie = true;
            }
            //Ascension
            // Calcul de Pentecote (11 jours apres Paques)
            $date_pentecote = mktime(date("H", $date_ascension), date("i", $date_ascension), date("s", $date_ascension), date("m", $date_ascension), date("d", $date_ascension) + 11, date("Y", $date_ascension));
            $jour_pentecote = date("d", $date_pentecote);
            $mois_pentecote = date("m", $date_pentecote);
            if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
                $ferie = true;
            }
            //Pentecote
            // Calul des samedis et dimanches
            $jour_julien = unixtojd($timestampStart);
            $jour_semaine = jddayofweek($jour_julien, 0);
            if ($jour_semaine == 0 || $jour_semaine == 6) {
                $ferie = true;
            }
            //Samedi (6) et dimanche (0)
        }
        // Pentecoste and Ascensione in Italy go to the sunday after: isn't holiday.
        // Pentecoste is 50 days after Easter, Ascensione 40
        if ($countrycode == 'IT') {
            $countryfound = 1;
            // Definition des dates feriees fixes
            if ($jour == 1 && $mois == 1) {
                $ferie = true;
            }
            // Capodanno
            if ($jour == 6 && $mois == 1) {
                $ferie = true;
            }
            // Epifania
            if ($jour == 25 && $mois == 4) {
                $ferie = true;
            }
            // Anniversario Liberazione
            if ($jour == 1 && $mois == 5) {
                $ferie = true;
            }
            // Festa del Lavoro
            if ($jour == 2 && $mois == 6) {
                $ferie = true;
            }
            // Festa della Repubblica
            if ($jour == 15 && $mois == 8) {
                $ferie = true;
            }
            // Ferragosto
            if ($jour == 1 && $mois == 11) {
                $ferie = true;
            }
            // Tutti i Santi
            if ($jour == 8 && $mois == 12) {
                $ferie = true;
            }
            // Immacolata Concezione
            if ($jour == 25 && $mois == 12) {
                $ferie = true;
            }
            // 25 decembre
            if ($jour == 26 && $mois == 12) {
                $ferie = true;
            }
            // Santo Stefano
            // Calcul du jour de paques
            $date_paques = easter_date($annee);
            $jour_paques = date("d", $date_paques);
            $mois_paques = date("m", $date_paques);
            if ($jour_paques == $jour && $mois_paques == $mois) {
                $ferie = true;
            }
            // Paques
            // Calul des samedis et dimanches
            $jour_julien = unixtojd($timestampStart);
            $jour_semaine = jddayofweek($jour_julien, 0);
            if ($jour_semaine == 0 || $jour_semaine == 6) {
                $ferie = true;
            }
            //Samedi (6) et dimanche (0)
        }
        if ($countrycode == 'ES') {
            $countryfound = 1;
            // Definition des dates feriees fixes
            if ($jour == 1 && $mois == 1) {
                $ferie = true;
            }
            // Año nuevo
            if ($jour == 6 && $mois == 1) {
                $ferie = true;
            }
            // Día Reyes
            if ($jour == 1 && $mois == 5) {
                $ferie = true;
            }
            // 1 Mayo
            if ($jour == 15 && $mois == 8) {
                $ferie = true;
            }
            // 15 Agosto
            if ($jour == 12 && $mois == 10) {
                $ferie = true;
            }
            // Día Hispanidad
            if ($jour == 1 && $mois == 11) {
                $ferie = true;
            }
            // 1 noviembre
            if ($jour == 6 && $mois == 12) {
                $ferie = true;
            }
            // Constitución
            if ($jour == 8 && $mois == 12) {
                $ferie = true;
            }
            // Inmaculada
            if ($jour == 25 && $mois == 12) {
                $ferie = true;
            }
            // 25 diciembre
            // Calcul día de Pascua
            $date_paques = easter_date($annee);
            $jour_paques = date("d", $date_paques);
            $mois_paques = date("m", $date_paques);
            if ($jour_paques == $jour && $mois_paques == $mois) {
                $ferie = true;
            }
            // Paques
            // Viernes Santo
            $date_viernes = mktime(date("H", $date_paques), date("i", $date_paques), date("s", $date_paques), date("m", $date_paques), date("d", $date_paques) - 2, date("Y", $date_paques));
            $jour_viernes = date("d", $date_viernes);
            $mois_viernes = date("m", $date_viernes);
            if ($jour_viernes == $jour && $mois_viernes == $mois) {
                $ferie = true;
            }
            //Viernes Santo
            // Calul des samedis et dimanches
            $jour_julien = unixtojd($timestampStart);
            $jour_semaine = jddayofweek($jour_julien, 0);
            if ($jour_semaine == 0 || $jour_semaine == 6) {
                $ferie = true;
            }
            //Samedi (6) et dimanche (0)
        }
        // Cas pays non defini
        if (!$countryfound) {
            // Calul des samedis et dimanches
            $jour_julien = unixtojd($timestampStart);
            $jour_semaine = jddayofweek($jour_julien, 0);
            if ($jour_semaine == 0 || $jour_semaine == 6) {
                $ferie = true;
            }
            //Samedi (6) et dimanche (0)
        }
        // On incremente compteur
        if ($ferie) {
            $nbFerie++;
        }
        // Increase number of days (on go up into loop)
        $timestampStart = dol_time_plus_duree($timestampStart, 1, 'd');
        //var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart);
        $i++;
    }
    return $nbFerie;
}
コード例 #23
0
ファイル: card.php プロジェクト: TAASA/Dolibarr-ERP-3.8.1
 print '<table class="noborder tableforservicepart2" width="100%">';
 // Definie date debut et fin par defaut
 $dateactstart = $objp->date_debut_reelle;
 if (GETPOST('remonth')) {
     $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
 } elseif (!$dateactstart) {
     $dateactstart = time();
 }
 $dateactend = $objp->date_fin_reelle;
 if (GETPOST('endmonth')) {
     $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
 } elseif (!$dateactend) {
     if ($objp->fk_product > 0) {
         $product = new Product($db);
         $product->fetch($objp->fk_product);
         $dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit);
     }
 }
 $now = dol_now();
 if ($dateactend > $now) {
     $dateactend = $now;
 }
 print '<tr ' . $bc[$var] . '><td colspan="2">';
 if ($objp->statut >= 4) {
     if ($objp->statut == 4) {
         print $langs->trans("DateEndReal") . ' ';
         print $form->select_date($dateactend, "end", $usehm, $usehm, $objp->date_fin_reelle > 0 ? 0 : 1, "closeline", 1, 1, 1);
     }
 }
 print '</td>';
 print '<td align="right" rowspan="2"><input type="submit" class="button" name="close" value="' . $langs->trans("Close") . '"><br>';
コード例 #24
0
function activitytrim($product_type)
{
    global $conf, $langs, $db;
    // We display the last 3 years
    $yearofbegindate = date('Y', dol_time_plus_duree(time(), -3, "y"));
    // breakdown by quarter
    $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot";
    $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f, " . MAIN_DB_PREFIX . "facturedet as fd";
    $sql .= " , " . MAIN_DB_PREFIX . "paiement as p," . MAIN_DB_PREFIX . "paiement_facture as pf";
    $sql .= " WHERE f.fk_soc = s.rowid";
    $sql .= " AND f.rowid = fd.fk_facture";
    $sql .= " AND pf.fk_facture = f.rowid";
    $sql .= " AND pf.fk_paiement= p.rowid";
    $sql .= " AND fd.product_type=" . $product_type;
    $sql .= " AND s.entity = " . $conf->entity;
    $sql .= " AND p.datep >= '" . $db->idate(dol_get_first_day($yearofbegindate), 1) . "'";
    $sql .= " GROUP BY annee, mois ";
    $sql .= " ORDER BY annee, mois ";
    $result = $db->query($sql);
    if ($result) {
        $tmpyear = $beginyear;
        $trim1 = 0;
        $trim2 = 0;
        $trim3 = 0;
        $trim4 = 0;
        $lgn = 0;
        $num = $db->num_rows($result);
        if ($num > 0) {
            print '<br>';
            print '<table class="noborder" width="75%">';
            if ($product_type == 0) {
                print '<tr class="liste_titre"><td  align=left>' . $langs->trans("ProductSellByQuarterHT") . '</td>';
            } else {
                print '<tr class="liste_titre"><td  align=left>' . $langs->trans("ServiceSellByQuarterHT") . '</td>';
            }
            print '<td align=right>' . $langs->trans("Quarter1") . '</td>';
            print '<td align=right>' . $langs->trans("Quarter2") . '</td>';
            print '<td align=right>' . $langs->trans("Quarter3") . '</td>';
            print '<td align=right>' . $langs->trans("Quarter4") . '</td>';
            print '<td align=right>' . $langs->trans("Total") . '</td>';
            print '</tr>';
        }
        $i = 0;
        while ($i < $num) {
            $objp = $db->fetch_object($result);
            if ($tmpyear != $objp->annee) {
                if ($trim1 + $trim2 + $trim3 + $trim4 > 0) {
                    print '<tr ><td align=left>' . $tmpyear . '</td>';
                    print '<td align=right>' . price($trim1) . '</td>';
                    print '<td align=right>' . price($trim2) . '</td>';
                    print '<td align=right>' . price($trim3) . '</td>';
                    print '<td align=right>' . price($trim4) . '</td>';
                    print '<td align=right>' . price($trim1 + $trim2 + $trim3 + $trim4) . '</td>';
                    print '</tr>';
                    $lgn++;
                }
                // We go to the following year
                $tmpyear = $objp->annee;
                $trim1 = 0;
                $trim2 = 0;
                $trim3 = 0;
                $trim4 = 0;
            }
            if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03") {
                $trim1 += $objp->Mnttot;
            }
            if ($objp->mois == "04" || $objp->mois == "05" || $objp->mois == "06") {
                $trim2 += $objp->Mnttot;
            }
            if ($objp->mois == "07" || $objp->mois == "08" || $objp->mois == "09") {
                $trim3 += $objp->Mnttot;
            }
            if ($objp->mois == "10" || $objp->mois == "11" || $objp->mois == "12") {
                $trim4 += $objp->Mnttot;
            }
            $i++;
        }
        if ($trim1 + $trim2 + $trim3 + $trim4 > 0) {
            print '<tr ><td align=left>' . $tmpyear . '</td>';
            print '<td align=right>' . price($trim1) . '</td>';
            print '<td align=right>' . price($trim2) . '</td>';
            print '<td align=right>' . price($trim3) . '</td>';
            print '<td align=right>' . price($trim4) . '</td>';
            print '<td align=right>' . price($trim1 + $trim2 + $trim3 + $trim4) . '</td>';
            print '</tr>';
        }
        if ($num > 0) {
            print '</table>';
        }
    }
}
コード例 #25
0
ファイル: card.php プロジェクト: Albertopf/prueba
     $form->select_date($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldayend');
 } else {
     if (GETPOST("afaire") == 2) {
         $form->select_date($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend');
     } else {
         $form->select_date($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldaystart');
     }
 }
 print '</td></tr>';
 // Date end
 $datef = $datef ? $datef : $object->datef;
 if (GETPOST('datef', 'int', 1)) {
     $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
 }
 if (empty($datef) && !empty($datep) && !empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS)) {
     $datef = dol_time_plus_duree($datep, $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS, 'h');
 }
 print '<tr><td><span id="dateend"' . (GETPOST("actioncode") == 'AC_RDV' ? ' class="fieldrequired"' : '') . '>' . $langs->trans("DateActionEnd") . '</span></td><td>';
 if (GETPOST("afaire") == 1) {
     $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend');
 } else {
     if (GETPOST("afaire") == 2) {
         $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend');
     } else {
         $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend');
     }
 }
 print '</td></tr>';
 // Status
 print '<tr><td width="10%">' . $langs->trans("Status") . ' / ' . $langs->trans("Percentage") . '</td>';
 print '<td>';
コード例 #26
0
    /**
     *   \brief      Constructeur. Definit les noms, constantes et boites
     *   \param      DB      Database handler
     */
    function modAdherent($DB)
    {
        $this->db = $DB;
        $this->numero = 310 ;

        $this->family = "hr";
		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
		$this->name = preg_replace('/^mod/i','',get_class($this));
        $this->description = "Gestion des adhérents d'une association";
        $this->version = 'dolibarr';                        // 'experimental' or 'dolibarr' or version
        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
        $this->special = 0;
        $this->picto='user';

        // Data directories to create when module is enabled
        $this->dirs = array("/adherent/temp");

        // Config pages
        //-------------
        $this->config_page_url = array("adherent.php@adherents");

        // Dependances
        //------------
        $this->depends = array();
        $this->requiredby = array();
        $this->langfiles = array("members","companies");

        // Constantes
        //-----------
        $this->const = array();
        $this->const[0]  = array("MAIN_SEARCHFORM_ADHERENT","yesno","1","Show form for quick member search");
        $this->const[1]  = array("ADHERENT_MAIL_RESIL","texte","Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt","Mail de résiliation");
        $this->const[2]  = array("ADHERENT_MAIL_VALID","texte","Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n","Mail de validation");
        $this->const[5]  = array("ADHERENT_MAIL_VALID_SUBJECT","chaine","Votre adhésion a été validée","Sujet du mail de validation");
        $this->const[6]  = array("ADHERENT_MAIL_RESIL_SUBJECT","chaine","Résiliation de votre adhésion","Sujet du mail de résiliation");
        $this->const[10] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman");
        $this->const[11] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman");
        $this->const[12] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to");
        $this->const[16] = array("ADHERENT_USE_SPIP_AUTO","yesno","","Utilisation de SPIP automatiquement");
        $this->const[17] = array("ADHERENT_SPIP_USER","chaine","","Utilisateur de connexion à la base spip");
        $this->const[18] = array("ADHERENT_SPIP_PASS","chaine","","Mot de passe de connexion à la base spip");
        $this->const[19] = array("ADHERENT_SPIP_SERVEUR","chaine","","serveur spip");
        $this->const[20] = array("ADHERENT_SPIP_DB","chaine","","db spip");
        $this->const[21] = array("ADHERENT_MAIL_FROM","chaine","","From des mails");
        $this->const[22] = array("ADHERENT_MAIL_COTIS","texte","Bonjour %PRENOM%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée","Mail de validation de cotisation");
        $this->const[23] = array("ADHERENT_MAIL_COTIS_SUBJECT","chaine","Reçu de votre cotisation","Sujet du mail de validation de cotisation");
        $this->const[25] = array("ADHERENT_CARD_HEADER_TEXT","chaine","%ANNEE%","Texte imprimé sur le haut de la carte adhérent");
        $this->const[26] = array("ADHERENT_CARD_FOOTER_TEXT","chaine","Association AZERTY","Texte imprimé sur le bas de la carte adhérent");
        $this->const[27] = array("ADHERENT_CARD_TEXT","texte","%PRENOM% %NOM%\r\nMembre ne %ID%\r\n%EMAIL%\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%","Texte imprimé sur la carte adhérent");
        $this->const[28] = array("ADHERENT_MAILMAN_ADMINPW","chaine","","Mot de passe Admin des liste mailman");
        $this->const[31] = array("ADHERENT_BANK_USE_AUTO","yesno","","Insertion automatique des cotisations dans le compte banquaire");
        $this->const[32] = array("ADHERENT_BANK_ACCOUNT","chaine","","ID du Compte banquaire utilise");
        $this->const[33] = array("ADHERENT_BANK_CATEGORIE","chaine","","ID de la catégorie banquaire des cotisations");
        $this->const[34] = array("ADHERENT_ETIQUETTE_TYPE","chaine","L7163","Type d'étiquette (pour impression de planche d'étiquettes)");

        // Boites
        //-------
        $this->boxes = array();
        $r=0;
        $this->boxes[$r][1] = "box_members.php";

        // Permissions
        //------------
        $this->rights = array();
        $this->rights_class = 'adherent';
        $r=0;

        // $this->rights[$r][0]     Id permission (unique tous modules confondus)
        // $this->rights[$r][1]     Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
        // $this->rights[$r][2]     Non utilise
        // $this->rights[$r][3]     1=Permis par defaut, 0=Non permis par defaut
        // $this->rights[$r][4]     Niveau 1 pour nommer permission dans code
        // $this->rights[$r][5]     Niveau 2 pour nommer permission dans code

        $r++;
        $this->rights[$r][0] = 71;
        $this->rights[$r][1] = 'Read members\' card';
        $this->rights[$r][2] = 'r';
        $this->rights[$r][3] = 1;
        $this->rights[$r][4] = 'lire';

        $r++;
        $this->rights[$r][0] = 72;
        $this->rights[$r][1] = 'Create/modify members (need also user module permissions if member linked to a user)';
        $this->rights[$r][2] = 'w';
        $this->rights[$r][3] = 0;
        $this->rights[$r][4] = 'creer';

        $r++;
        $this->rights[$r][0] = 74;
        $this->rights[$r][1] = 'Remove members';
        $this->rights[$r][2] = 'd';
        $this->rights[$r][3] = 0;
        $this->rights[$r][4] = 'supprimer';

        $r++;
        $this->rights[$r][0] = 76;
        $this->rights[$r][1] = 'Export members';
        $this->rights[$r][2] = 'r';
        $this->rights[$r][3] = 0;
        $this->rights[$r][4] = 'export';

        $r++;
        $this->rights[$r][0] = 75;
        $this->rights[$r][1] = 'Setup types and attributes of members';
        $this->rights[$r][2] = 'w';
        $this->rights[$r][3] = 0;
        $this->rights[$r][4] = 'configurer';

        $r++;
        $this->rights[$r][0] = 78;
        $this->rights[$r][1] = 'Read subscriptions';
        $this->rights[$r][2] = 'r';
        $this->rights[$r][3] = 1;
        $this->rights[$r][4] = 'cotisation';
        $this->rights[$r][5] = 'lire';

        $r++;
        $this->rights[$r][0] = 79;
        $this->rights[$r][1] = 'Create/modify/remove subscriptions';
        $this->rights[$r][2] = 'w';
        $this->rights[$r][3] = 0;
        $this->rights[$r][4] = 'cotisation';
        $this->rights[$r][5] = 'creer';

        // 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."/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_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent');
        $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');
        $this->import_entities_array[$r]=array();   // We define here only fields that use another picto
        $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'=>'*****@*****.**','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'));
    }