Exemplo n.º 1
0
        setEventMessage($object->error, 'errors');
        $action = 'edit';
    } else {
        setEventMessage($langs->trans('CronSaveSucess'), 'mesgs');
        $action = '';
    }
}
/*
 * View
 */
$form = new Form($db);
$formCron = new FormCron($db);
llxHeader('', $langs->trans("CronAdd"));
if ($action == 'edit' || empty($action) || $action == 'delete' || $action == 'execute') {
    $head = cron_prepare_head($object);
    print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron');
} elseif ($action == 'create') {
    print_fiche_titre($langs->trans("CronTask"), '', 'setup');
}
if ($conf->use_javascript_ajax) {
    print "\n" . '<script type="text/javascript" language="javascript">';
    print 'jQuery(document).ready(function () {
                    function initfields()
                    {
                        if ($("#jobtype option:selected").val()==\'method\') {
							$(".blockmethod").show();
							$(".blockcommand").hide();
						}
						if ($("#jobtype option:selected").val()==\'command\') {
							$(".blockmethod").hide();
							$(".blockcommand").show();
 /**
  *  Assign custom values for canvas
  *
  *  @param	string		&$action    	Type of action
  *  @param	int			$id				Id
  *  @return	void
  */
 function assign_values(&$action, $id)
 {
     global $conf, $db, $langs, $user;
     global $form;
     $ret = $this->getObject($id);
     parent::assign_values($action, $id);
     $this->tpl['title'] = $this->getTitle($action);
     $this->tpl['error'] = $this->error;
     $this->tpl['errors'] = $this->errors;
     if ($action == 'view') {
         // Card header
         $head = contact_prepare_head($this->object);
         $title = $this->getTitle($action);
         $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'contact');
         $this->tpl['showend'] = dol_get_fiche_end();
         $objsoc = new Societe($db);
         $objsoc->fetch($this->object->socid);
         $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
         $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
     } else {
         // Confirm delete contact
         if ($action == 'delete' && $user->rights->societe->contact->supprimer) {
             $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
         }
     }
     if ($action == 'list') {
         $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
     }
 }
Exemplo n.º 3
0
/**
 *	Show tab header of a card
 *	@param	    links		Array of tabs
 *	@param	    active      Active tab name
 *	@param      title       Title
 *	@param      notab		0=Add tab header, 1=no tab header
 * 	@param		picto		Add a picto on tab title
 */
function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0, $picto = '')
{
    print dol_get_fiche_head($links, $active, $title, $notab, $picto);
}
require 'config.php';
dol_include_once('/core/class/html.form.class.php');
if (!$user->rights->mandarin->graph->project_by_user) {
    accessforbidden();
}
$langs->load('mandarin@mandarin');
$userid = GETPOST('userid');
if ($userid != 0) {
    $userdefault = $userid;
} elseif (user_est_responsable_hierarchique()) {
    $userid = $user->id;
}
// Begin of page
llxHeader('', $langs->trans('linkMenuProjectByUserReport'), '');
print dol_get_fiche_head('linkMenuProjectByUserReport');
print_fiche_titre($langs->trans('linkMenuProjectByUserReport'));
print_form_filter($userid);
$TData = get_data_tab($userid);
draw_table($TData, get_list_id_user($TData), get_tab_label_statut_opportunite());
print '<br />';
draw_graphique($TData, get_tab_label_statut_opportunite());
llxFooter();
function print_form_filter($userid)
{
    global $db, $langs;
    $langs->load('users');
    $form = new Form($db);
    print '<form name="filter" methode="GET" action="' . $_SERVER['PHP_SELF'] . '">';
    print $langs->trans('HierarchicalResponsible');
    print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', '', 1);
Exemplo n.º 5
0
}
$arrayofjs = array();
$arrayofcss = array('/opensurvey/css/style.css');
llxHeader('', $object->titre, 0, 0, 0, 0, $arrayofjs, $arrayofcss);
// Define format of choices
$toutsujet = explode(",", $object->sujet);
$listofanswers = array();
foreach ($toutsujet as $value) {
    $tmp = explode('@', $value);
    $listofanswers[] = array('label' => $tmp[0], 'format' => $tmp[1] ? $tmp[1] : 'checkbox');
}
$toutsujet = str_replace("@", "<br>", $toutsujet);
$toutsujet = str_replace("°", "'", $toutsujet);
print '<form name="formulaire4" action="#" method="POST">' . "\n";
$head = opensurvey_prepare_head($object);
print dol_get_fiche_head($head, 'preview', $langs->trans("Survey"), 0, dol_buildpath('/opensurvey/img/object_opensurvey.png', 1), 1);
print '<table class="border" width="100%">';
$linkback = '<a href="' . dol_buildpath('/opensurvey/list.php', 1) . (!empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="18%">' . $langs->trans('Ref') . '</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
print '</td>';
print '</tr>';
// Type
$type = $object->format == "A" ? 'classic' : 'date';
print '<tr><td>' . $langs->trans("Type") . '</td><td colspan="2">';
print img_picto('', dol_buildpath('/opensurvey/img/' . ($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
print ' ' . $langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate") . '</td></tr>';
// Title
print '<tr><td>';
Exemplo n.º 6
0
/**
 *	Show tab header of a card
 *	@param	    links		Array of tabs
 *	@param	    active      Active tab name
 *	@param      title       Title
 *	@param      notab		0=Add tab header, 1=no tab header
 * 	@param		picto		Add a picto on tab title
 */
function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0, $picto = '')
{
    //fazendo com que todas as paginas com abas de detalhes fiquem sem título, fica melhor somente as abas rafso
    //era print dol_get_fiche_head($links, $active, $title, $notab, $picto);
    print dol_get_fiche_head($links, $active, '', $notab, $picto);
}
$action = __get('action', 'view');
$page = __get('page', 0);
if ($page < 0) {
    $page = 0;
}
$limit = $conf->liste_limit;
$offset = $limit * $page;
if (!$user->rights->recurrence->all->read) {
    accessforbidden();
}
/*
 * HEADER
 */
llxHeader('', 'Récurrence des charges sociales');
print_fiche_titre('Récurrence des charges sociales', '', 'report.png@report');
print dol_get_fiche_head(array(array(dol_buildpath('/recurrence/gestion.php?action=view', 1), 'Liste des récurrences', 'view'), array(dol_buildpath('/recurrence/gestion.php?action=add', 1), 'Enregistrer une tâche récurrente', 'add')), $action, '');
echo '<form method="POST" action="paiement.php">';
// Formulaire pour la gestion des paiements
_liste_charges_sociales($PDOdb, $action, $page, $limit, $offset);
if ($user->rights->tax->charges->creer) {
    if ($action == 'add') {
        if ($user->rights->tax->charges->creer) {
            echo '<div class="tabsAction">';
            echo '
			<div class="inline-block divButAction">
				<a class="butAction" href="' . DOL_URL_ROOT . '/compta/sociales/charges.php?leftmenu=tax_social&action=create">
					Ajouter une charge sociale
				</a>
			</div>';
            echo '</div>';
        }
require 'config.php';
dol_include_once('/core/class/html.form.class.php');
if (!$user->rights->mandarin->graph->action_by_user) {
    accessforbidden();
}
$langs->load('mandarin@mandarin');
$userid = GETPOST('userid');
if ($userid != 0) {
    $userdefault = $userid;
} elseif (user_est_responsable_hierarchique()) {
    $userid = $user->id;
}
// Begin of page
llxHeader('', $langs->trans('mandarinTitleGraphEventByUser'), '');
print dol_get_fiche_head('RapportEvenementsParCommerciaux');
print_fiche_titre($langs->trans('RapportEvenementsParCommerciaux'));
print_form_filter($userid);
$TData = get_data_tab($userid);
draw_table($TData, get_list_id_user($TData), get_tab_label_action_comm());
print '<br />';
draw_graphique($TData, get_tab_label_action_comm());
llxFooter();
function print_form_filter($userid)
{
    global $db, $langs;
    $langs->load('users');
    $form = new Form($db);
    print '<form name="filter" methode="GET" action="' . $_SERVER['PHP_SELF'] . '">';
    print $langs->trans('HierarchicalResponsible');
    print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', '', 1);
<?php

require 'config.php';
dol_include_once('/projet/class/project.class.php');
dol_include_once('/projet/class/task.class.php');
dol_include_once('/user/class/user.class.php');
dol_include_once('/core/lib/usergroups.lib.php');
llxHeader('', $langs->trans('RapportCapaciteProduction'));
_print_tab_header();
print dol_get_fiche_head($langs->trans('RapportCapaciteProduction'));
print_fiche_titre($langs->trans("Capacité de production par période"));
_print_filtres();
print_rapport();
function print_rapport()
{
    global $langs;
    $date_d = preg_replace('/\\//', '-', GETPOST('date_deb'));
    $date_f = preg_replace('/\\//', '-', GETPOST('date_fin'));
    $date_deb = date('Y-m-d', strtotime($date_d));
    $date_fin = date('Y-m-d', strtotime($date_f));
    if (empty(GETPOST('date_deb'))) {
        $date_deb = date('Y-m-d', strtotime(date('Y-m-d')) - 60 * 60 * 24 * 7);
    }
    if (empty(GETPOST('date_fin'))) {
        $date_fin = date('Y-m-d');
    }
    $PDOdb = new TPDOdb();
    $interval = (strtotime($date_fin) - strtotime($date_deb)) / 3600 / 24;
    $TDataBrut = get_user_capacity_period($date_deb, $date_fin);
    $TData = array();
    $total_temps_saisi = 0;
Exemplo n.º 10
0
    print '</tr>';
    print '</table>';
    print '</form>';
}
/* *************************************************************************** */
/*                                                                             */
/* Mode fiche                                                                  */
/*                                                                             */
/* *************************************************************************** */
if ($id > 0) {
    $object = new ChargeSociales($db);
    $result = $object->fetch($id);
    if ($result > 0) {
        dol_htmloutput_mesg($mesg);
        $head = tax_prepare_head($object);
        print dol_get_fiche_head($head, 'card', $langs->trans("SocialContribution"), 0, 'bill');
        // Confirmation de la suppression de la charge
        if ($action == 'paid') {
            $text = $langs->trans('ConfirmPaySocialContribution');
            print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans('PaySocialContribution'), $text, "confirm_paid", '', '', 2);
        }
        if ($action == 'delete') {
            $text = $langs->trans('ConfirmDeleteSocialContribution');
            print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('DeleteSocialContribution'), $text, 'confirm_delete', '', '', 2);
        }
        if ($action == 'edit') {
            print "<form name=\"charge\" action=\"charges.php?id={$object->id}&amp;action=update\" method=\"post\">";
            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        }
        print '<table class="border" width="100%">';
        // Ref
Exemplo n.º 11
0
function _fiche_control(&$PDOdb, &$assetOf)
{
    global $langs, $db, $conf;
    llxHeader('', $langs->trans('OFAsset'), '', '');
    print dol_get_fiche_head(ofPrepareHead($assetOf, 'assetOF'), 'controle', $langs->trans('OFAsset'));
    /******/
    $TBS = new TTemplateTBS();
    $TBS->TBS->protect = false;
    $TBS->TBS->noerr = true;
    $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'POST');
    $form->Set_typeaff('view');
    $TControl = _fiche_ligne_control($PDOdb, $assetOf->getId());
    $TAssetOFControl = _fiche_ligne_control($PDOdb, $assetOf->getId(), $assetOf);
    print $TBS->render('tpl/fiche_of_control.tpl.php', array('TControl' => $TControl, 'TAssetOFControl' => $TAssetOFControl), array('assetOf' => array('id' => (int) $assetOf->getId()), 'view' => array('nbTControl' => count($TControl), 'nbTAssetOFControl' => count($TAssetOFControl), 'url' => DOL_URL_ROOT . '/custom/of/fiche_of.php')));
    $form->end();
    /******/
    llxFooter('$Date: 2011/07/31 22:21:57 $ - $Revision: 1.19 $');
}
	/**
	 *    Assign custom values for canvas
	 *    @param      action     Type of action
	 */
	function assign_values($action='')
	{
		global $conf, $db, $langs, $user;
		global $form;

		parent::assign_values($action);

        $this->tpl['title'] = $this->getTitle($action);
        $this->tpl['error'] = $this->error;
        $this->tpl['errors']= $this->errors;

		if ($action == 'view')
		{
            // Card header
            $head = contact_prepare_head($this->object);
            $title = $this->getTitle($action);

		    $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'contact');
		    $this->tpl['showend']=dol_get_fiche_end();

			// Confirm delete contact
        	if ($user->rights->societe->contact->supprimer)
        	{
        		if ($_GET["action"] == 'delete')
        		{
        			$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
        		}
        	}

        	$objsoc = new Societe($db);
            $objsoc->fetch($this->object->fk_soc);

            $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);

            $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
		}
	}
<?php

require 'config.php';
dol_include_once('/projet/class/project.class.php');
dol_include_once('/projet/class/task.class.php');
dol_include_once('/user/class/user.class.php');
dol_include_once('/core/lib/usergroups.lib.php');
dol_include_once('/comm/propal/class/propal.class.php');
llxHeader('', $langs->trans('graphProjectCDP'));
print dol_get_fiche_head($langs->trans('graphProjectCDP'));
print_fiche_titre($langs->trans("graphProjectCDP"));
_print_graph();
function _print_graph()
{
    global $db, $langs;
    $PDOdb = new TPDOdb();
    $TDataBrut = $TData = _get_projet_cdp();
    //var_dump($TDataBrut);
    $explorer = new stdClass();
    $explorer->actions = array("dragToZoom", "rightClickToReset");
    $listeview = new TListviewTBS('graphProjectCDP');
    print $listeview->renderArray($PDOdb, $TData, array('type' => 'chart', 'chartType' => 'ColumnChart', 'liste' => array('titre' => $langs->transnoentities('graphProjectCDP')), 'hAxis' => array('title' => 'Chef de projet'), 'vAxis' => array('title' => 'Nombre de projets'), 'explorer' => $explorer));
}
function _get_projet_cdp()
{
    global $db;
    $TData = array();
    $sql = 'SELECT COUNT(p.rowid) AS nombre, ec.fk_socpeople AS user FROM ' . MAIN_DB_PREFIX . 'projet p ';
    $sql .= 'INNER JOIN ' . MAIN_DB_PREFIX . 'element_contact ec ON ec.element_id=p.rowid ';
    $sql .= 'WHERE ec.fk_c_type_contact = 160 AND p.fk_statut=1 ';
    $sql .= 'GROUP BY ec.fk_socpeople ';
    /**
	 *    Assign custom values for canvas (for example into this->tpl to be used by templates)
	 *
	 *    @param	string	&$action    Type of action
	 *    @param	string	$id			Id of object
	 *    @param	string	$ref		Ref of object
	 *    @return	void
	 */
	function assign_values(&$action, $id=0, $ref='')
	{
        global $conf, $langs, $user, $mysoc, $canvas;
		global $form, $formproduct;

   		$tmpobject = new Product($this->db);
   		if (! empty($id) || ! empty($ref)) $tmpobject->fetch($id,$ref);
        $this->object = $tmpobject;

		//parent::assign_values($action);

	    foreach($this->object as $key => $value)
        {
            $this->tpl[$key] = $value;
        }

        $this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors);

		// canvas
		$this->tpl['canvas'] = $this->canvas;

		// id
		$this->tpl['id'] = $this->id;

		// Ref
		$this->tpl['ref'] = $this->ref;

		// Label
		$this->tpl['label'] = $this->libelle;

		// Description
		$this->tpl['description'] = nl2br($this->description);

		// Statut
		$this->tpl['status'] = $this->getLibStatut(2);

		// Note
		$this->tpl['note'] = nl2br($this->note);

		if ($action == 'create')
		{
			// Price
			$this->tpl['price'] = $this->price;
			$this->tpl['price_min'] = $this->price_min;
			$this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type");

			// VAT
			$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
		}

		if ($action == 'create' || $action == 'edit')
		{
			// Status
			$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
			$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);

			//To Buy
			$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
			$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);

            $this->tpl['description'] = $this->description;
            $this->tpl['note'] = $this->note;
		}

		if ($action == 'view')
		{
            $head = product_prepare_head($this->object,$user);

            $this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref');

    		$titre=$langs->trans("CardProduct".$this->object->type);
    		$picto=($this->object->type==1?'service':'product');
    		$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
            $this->tpl['showend']=dol_get_fiche_end();

			// Accountancy buy code
			$this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer);
			$this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer);

			// Accountancy sell code
			$this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer);
			$this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer);
		}

		$this->tpl['finished'] = $this->object->finished;
		$this->tpl['ref'] = $this->object->ref;
		$this->tpl['label'] = $this->object->label;
		$this->tpl['id'] = $this->object->id;
		$this->tpl['type'] = $this->object->type;
		$this->tpl['note'] = $this->object->note;
		$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;

		// Duration
		$this->tpl['duration_value'] = $this->object->duration_value;

		if ($action == 'create')
		{
			// Title
			$this->tpl['title'] = $langs->trans("NewService");
		}

		if ($action == 'edit')
		{
			$this->tpl['title'] = $langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->object->ref;
		}

		if ($action == 'create' || $action == 'edit')
		{
    		// Status
    		$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
    		$this->tpl['status'] = $form->selectarray('statut',$statutarray,$_POST["statut"]);

    		$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
    		$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);

		    // Duration unit
			// TODO creer fonction
			$duration_unit = '<input name="duration_unit" type="radio" value="h"'.($this->object->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="d"'.($this->object->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="w"'.($this->object->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="m"'.($this->object->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="y"'.($this->object->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
			$this->tpl['duration_unit'] = $duration_unit;
		}

		if ($action == 'view')
		{
    		// Status
    		$this->tpl['status'] = $this->object->getLibStatut(2,0);
    		$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);

		    // Photo
			$this->tpl['nblignes'] = 4;
			if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity]))
			{
				$this->tpl['photos'] = $this->object->show_photos($conf->service->multidir_output[$this->object->entity],1,1,0,0,0,80);
			}

			// Duration
			if ($this->object->duration_value > 1)
			{
				$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
			}
			else if ($this->object->duration_value > 0)
			{
				$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
			}
			$this->tpl['duration_unit'] = $langs->trans($dur[$this->object->duration_unit]);

			$this->tpl['fiche_end']=dol_get_fiche_end();
		}

		if ($action == 'list')
		{
	        $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
		}

	}
 /**
  *    Assign custom values for canvas (for example into this->tpl to be used by templates)
  *
  *    @param	string	$action    Type of action
  *    @param	string	$id			Id of object
  *    @param	string	$ref		Ref of object
  *    @return	void
  */
 function assign_values(&$action, $id = 0, $ref = '')
 {
     global $conf, $langs, $user, $mysoc, $canvas;
     global $form, $formproduct;
     $tmpobject = new Product($this->db);
     if (!empty($id) || !empty($ref)) {
         $tmpobject->fetch($id, $ref);
     }
     $this->object = $tmpobject;
     //parent::assign_values($action);
     foreach ($this->object as $key => $value) {
         $this->tpl[$key] = $value;
     }
     $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors);
     // canvas
     $this->tpl['canvas'] = $this->canvas;
     // id
     $this->tpl['id'] = $this->id;
     // Ref
     $this->tpl['ref'] = $this->ref;
     // Label
     $this->tpl['label'] = $this->libelle;
     // Description
     $this->tpl['description'] = nl2br($this->description);
     // Statut
     $this->tpl['status'] = $this->object->getLibStatut(2);
     // Note
     $this->tpl['note'] = nl2br($this->note);
     if ($action == 'create') {
         // Price
         $this->tpl['price'] = $this->price;
         $this->tpl['price_min'] = $this->price_min;
         $this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type");
         // VAT
         $this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, '');
     }
     if ($action == 'create' || $action == 'edit') {
         // Status
         $statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
         $this->tpl['status'] = $form->selectarray('statut', $statutarray, $this->status);
         //To Buy
         $statutarray = array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
         $this->tpl['tobuy'] = $form->selectarray('tobuy', $statutarray, $this->status_buy);
         $this->tpl['description'] = $this->description;
         $this->tpl['note'] = $this->note;
     }
     if ($action == 'view') {
         $head = product_prepare_head($this->object, $user);
         $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'ref', '', 1, 'ref');
         $titre = $langs->trans("CardProduct" . $this->object->type);
         $picto = $this->object->type == 1 ? 'service' : 'product';
         $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $titre, 0, $picto);
         $this->tpl['showend'] = dol_get_fiche_end();
         // Accountancy buy code
         $this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer);
         $this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer);
         // Accountancy sell code
         $this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer);
         $this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer);
     }
     $this->tpl['finished'] = $this->object->finished;
     $this->tpl['ref'] = $this->object->ref;
     $this->tpl['label'] = $this->object->label;
     $this->tpl['id'] = $this->object->id;
     $this->tpl['type'] = $this->object->type;
     $this->tpl['note'] = $this->object->note;
     $this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
     if ($action == 'create') {
         // Title
         $this->tpl['title'] = $langs->trans("NewProduct");
     }
     if ($action == 'edit') {
         $this->tpl['title'] = $langs->trans('Modify') . ' ' . $langs->trans('Product') . ' : ' . $this->object->ref;
     }
     if ($action == 'create' || $action == 'edit') {
         // Status
         $statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
         $this->tpl['status'] = $form->selectarray('statut', $statutarray, $_POST["statut"]);
         $statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
         $this->tpl['status_buy'] = $form->selectarray('statut_buy', $statutarray, $_POST["statut_buy"]);
         // Finished
         $statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
         $this->tpl['finished'] = $form->selectarray('finished', $statutarray, $this->object->finished);
         // Weight
         $this->tpl['weight'] = $this->object->weight;
         $this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units", "weight", $this->object->weight_units);
         // Length
         $this->tpl['length'] = $this->object->length;
         $this->tpl['length_units'] = $formproduct->load_measuring_units("length_units", "size", $this->object->length_units);
         // Surface
         $this->tpl['surface'] = $this->object->surface;
         $this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units", "surface", $this->object->surface_units);
         // Volume
         $this->tpl['volume'] = $this->object->volume;
         $this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units", "volume", $this->object->volume_units);
     }
     if ($action == 'view') {
         // Status
         $this->tpl['status'] = $this->object->getLibStatut(2, 0);
         $this->tpl['status_buy'] = $this->object->getLibStatut(2, 1);
         // Photo
         $this->tpl['nblignes'] = 4;
         if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity])) {
             $this->tpl['photos'] = $this->object->show_photos($conf->product->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80);
         }
         // Nature
         $this->tpl['finished'] = $this->object->getLibFinished();
         // Weight
         if ($this->object->weight != '') {
             $this->tpl['weight'] = $this->object->weight . " " . measuring_units_string($this->object->weight_units, "weight");
         }
         // Length
         if ($this->object->length != '') {
             $this->tpl['length'] = $this->object->length . " " . measuring_units_string($this->object->length_units, "size");
         }
         // Surface
         if ($this->object->surface != '') {
             $this->tpl['surface'] = $this->object->surface . " " . measuring_units_string($this->object->surface_units, "surface");
         }
         // Volume
         if ($this->object->volume != '') {
             $this->tpl['volume'] = $this->object->volume . " " . measuring_units_string($this->object->volume_units, "volume");
         }
         $this->tpl['fiche_end'] = dol_get_fiche_end();
     }
     if ($action == 'list') {
         $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
     }
 }
    /**
     *    Assign custom values for canvas (for example into this->tpl to be used by templates)
     *
     *    @param	string	$action    Type of action
     *    @param	string	$id			Id of object
     *    @param	string	$ref		Ref of object
     *    @return	void
     */
    function assign_values(&$action, $id = 0, $ref = '')
    {
        global $conf, $langs, $user, $mysoc, $canvas;
        global $form, $formadmin, $formcompany;
        if ($action == 'add' || $action == 'update') {
            $this->assign_post($action);
        }
        if ($_GET["type"] == 'f') {
            $this->object->fournisseur = 1;
        }
        if ($_GET["type"] == 'c') {
            $this->object->client = 1;
        }
        if ($_GET["type"] == 'p') {
            $this->object->client = 2;
        }
        if ($_GET["type"] == 'cp') {
            $this->object->client = 3;
        }
        if ($_REQUEST["private"] == 1) {
            $this->object->particulier = 1;
        }
        foreach ($this->object as $key => $value) {
            $this->tpl[$key] = $value;
        }
        $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors);
        if (is_array($GLOBALS['errors'])) {
            $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error');
        }
        if ($action == 'create') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selecttype'] = "\n" . '<script type="text/javascript" language="javascript">
				$(document).ready(function () {
		              $("#radiocompany").click(function() {
                            document.formsoc.action.value="create";
                            document.formsoc.canvas.value="company";
                            document.formsoc.private.value=0;
                            document.formsoc.submit();
		              });
		               $("#radioprivate").click(function() {
                            document.formsoc.action.value="create";
                            document.formsoc.canvas.value="individual";
                            document.formsoc.private.value=1;
                            document.formsoc.submit();
                      });
		          });
                </script>' . "\n";
            }
        }
        if ($action == 'create' || $action == 'edit') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript">
				$(document).ready(function () {
						$("#selectcountry_id").change(function() {
							document.formsoc.action.value="' . $action . '";
							document.formsoc.canvas.value="' . $canvas . '";
							document.formsoc.submit();
						});
					})
				</script>' . "\n";
            }
            // Load object modCodeClient
            $module = !empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard';
            if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                $module = substr($module, 0, dol_strlen($module) - 4);
            }
            $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
            foreach ($dirsociete as $dirroot) {
                $res = dol_include_once($dirroot . $module . '.php');
                if ($res) {
                    break;
                }
            }
            $modCodeClient = new $module($db);
            $this->tpl['auto_customercode'] = $modCodeClient->code_auto;
            // We verified if the tag prefix is used
            if ($modCodeClient->code_auto) {
                $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
            }
            // TODO create a function
            $this->tpl['select_customertype'] = '<select class="flat" name="client">';
            $this->tpl['select_customertype'] .= '<option value="2"' . ($this->object->client == 2 ? ' selected="selected"' : '') . '>' . $langs->trans('Prospect') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="3"' . ($this->object->client == 3 ? ' selected="selected"' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="1"' . ($this->object->client == 1 ? ' selected="selected"' : '') . '>' . $langs->trans('Customer') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="0"' . ($this->object->client == 0 ? ' selected="selected"' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
            $this->tpl['select_customertype'] .= '</select>';
            // Customer
            $this->tpl['customercode'] = $this->object->code_client;
            if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) {
                $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0);
            }
            $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable();
            $s = $modCodeClient->getToolTip($langs, $this->object, 0);
            $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1);
            if (!empty($conf->fournisseur->enabled)) {
                $this->tpl['supplier_enabled'] = 1;
                // Load object modCodeFournisseur
                $module = $conf->global->SOCIETE_CODECLIENT_ADDON;
                if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                    $module = substr($module, 0, dol_strlen($module) - 4);
                }
                $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
                foreach ($dirsociete as $dirroot) {
                    $res = dol_include_once($dirroot . $module . '.php');
                    if ($res) {
                        break;
                    }
                }
                $modCodeFournisseur = new $module();
                $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
                // We verified if the tag prefix is used
                if ($modCodeFournisseur->code_auto) {
                    $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
                }
                // Supplier
                $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1);
                $this->tpl['suppliercode'] = $this->object->code_fournisseur;
                if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
                    $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1);
                }
                $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable();
                $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1);
                $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1);
                $this->object->LoadSupplierCateg();
                $this->tpl['suppliercategory'] = $this->object->SupplierCategories;
            }
            // Zip
            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
            // Town
            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
            // Country
            $this->object->country_id = $this->object->country_id ? $this->object->country_id : $mysoc->country_id;
            $this->object->country_code = $this->object->country_code ? $this->object->country_code : $mysoc->country_code;
            $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
            $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')';
            if ($user->admin) {
                $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
            }
            // State
            if ($this->object->country_id) {
                $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
            } else {
                $this->tpl['select_state'] = $countrynotdefined;
            }
            // Language
            if (!empty($conf->global->MAIN_MULTILANGS)) {
                $this->tpl['select_lang'] = $formadmin->select_language($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, 0, 1);
            }
            // VAT
            $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1);
            // Assujeti par defaut en creation
            // Select users
            $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1);
            // Local Tax
            // TODO mettre dans une classe propre au pays
            if ($mysoc->country_code == 'ES') {
                $this->tpl['localtax'] = '';
                if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td>';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td>';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td></tr>';
                } elseif ($mysoc->localtax1_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td colspan="3">';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><tr>';
                } elseif ($mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td colspan="3">';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><tr>';
                }
            }
        } else {
            $head = societe_prepare_head($this->object);
            $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company');
            $this->tpl['showend'] = dol_get_fiche_end();
            $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom');
            $this->tpl['checkcustomercode'] = $this->object->check_codeclient();
            $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
            $this->tpl['address'] = dol_nl2br($this->object->address);
            $img = picto_from_langcode($this->object->country_code);
            if ($this->object->isInEEC()) {
                $this->tpl['country'] = $form->textwithpicto(($img ? $img . ' ' : '') . $this->object->country, $langs->trans("CountryIsInEEC"), 1, 0);
            }
            $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country;
            $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
            $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
            $this->tpl['url'] = dol_print_url($this->object->url);
            $this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
            // Third party type
            $arr = $formcompany->typent_array(1);
            $this->tpl['typent'] = $arr[$this->object->typent_code];
            if (!empty($conf->global->MAIN_MULTILANGS)) {
                require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
                //$s=picto_from_langcode($this->default_lang);
                //print ($s?$s.' ':'');
                $langs->load("languages");
                $this->tpl['default_lang'] = $this->default_lang ? $langs->trans('Language_' . $this->object->default_lang) : '';
            }
            $this->tpl['image_edit'] = img_edit();
            $this->tpl['display_rib'] = $this->object->display_rib();
            // Sales representatives
            $this->tpl['sales_representatives'] = '';
            $listsalesrepresentatives = $this->object->getSalesRepresentatives($user);
            $nbofsalesrepresentative = count($listsalesrepresentatives);
            if ($nbofsalesrepresentative > 3) {
                $this->tpl['sales_representatives'] .= '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $this->object->id . '">';
                $this->tpl['sales_representatives'] .= $nbofsalesrepresentative;
                $this->tpl['sales_representatives'] .= '</a>';
            } else {
                if ($nbofsalesrepresentative > 0) {
                    $userstatic = new User($this->db);
                    $i = 0;
                    foreach ($listsalesrepresentatives as $val) {
                        $userstatic->id = $val['id'];
                        $userstatic->lastname = $val['name'];
                        $userstatic->firstname = $val['firstname'];
                        $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1);
                        $i++;
                        if ($i < $nbofsalesrepresentative) {
                            $this->tpl['sales_representatives'] .= ', ';
                        }
                    }
                } else {
                    $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected");
                }
            }
            // Linked member
            if (!empty($conf->adherent->enabled)) {
                $langs->load("members");
                $adh = new Adherent($this->db);
                $result = $adh->fetch('', '', $this->object->id);
                if ($result > 0) {
                    $adh->ref = $adh->getFullName($langs);
                    $this->tpl['linked_member'] = $adh->getNomUrl(1);
                } else {
                    $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember");
                }
            }
            // Local Tax
            // TODO mettre dans une classe propre au pays
            if ($mysoc->country_code == 'ES') {
                $this->tpl['localtax'] = '';
                if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax1_assuj) . '</td>';
                    $this->tpl['localtax'] .= '<td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax2_assuj) . '</td></tr>';
                } elseif ($mysoc->localtax1_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax1_assuj) . '</td></tr>';
                } elseif ($mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax2_assuj) . '</td></tr>';
                }
            }
        }
    }
<?php

require 'config.php';
dol_include_once('/projet/class/project.class.php');
dol_include_once('/projet/class/task.class.php');
if (!$user->rights->mandarin->graph->project) {
    accesfobidden();
}
llxHeader('', $langs->trans('ReportExceed'));
print dol_get_fiche_head('Projets en dépassement');
print_fiche_titre($langs->trans("Projets en dépassement"));
printRapport();
function printRapport()
{
    global $db;
    dol_include_once('/core/lib/date.lib.php');
    $fk_statut = GETPOST("fk_statut");
    ?>
		<style type="text/css">
		table#rapport_depassement td,table#rapport_depassement th {
			white-space: nowrap;
			border-right: 1px solid #D8D8D8;
			border-bottom: 1px solid #D8D8D8;
		}
		</style>
		
		<div style="padding-bottom: 25px;">
			<table id="rapport_depassement" class="noborder" width="100%">
				<thead>
					<tr style="text-align:left;" class="liste_titre nodrag nodrop">
						<th class="liste_titre">Projet</th>