35require 
'../main.inc.php';
 
   36require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
 
   37require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
 
   38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
 
   39require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
 
   40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
 
   41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
 
   43if (isModEnabled(
'agenda')) {
 
   44  require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
 
   46if (isModEnabled(
'bank')) {
 
   47  require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
 
   49if (isModEnabled(
'category')) {
 
   50  require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
   52if (isModEnabled(
'order')) {
 
   53  require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
 
   55if (isModEnabled(
'contract')) {
 
   56  require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
 
   58if (isModEnabled(
'deplacement')) {
 
   59  require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
 
   61if (isModEnabled(
'don')) {
 
   62  require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
 
   64if (isModEnabled(
'shipping')) {
 
   65  require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
 
   67if (isModEnabled(
'expensereport')) {
 
   68  require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
 
   70if (isModEnabled(
'invoice')) {
 
   71  require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
 
   72  require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
 
   74if (isModEnabled(
'intervention')) {
 
   75  require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
 
   77if (isModEnabled(
'loan')) {
 
   78  require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
 
   79  require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
 
   81if (isModEnabled(
'mrp')) {
 
   82  require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
 
   84if (isModEnabled(
'propal')) {
 
   85  require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
 
   87if (isModEnabled(
'salaries')) {
 
   88  require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
 
   90if (isModEnabled(
'stock')) {
 
   91  require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
 
   92  require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
 
   94if (isModEnabled(
'supplier_invoice')) {
 
   95  require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
 
   97if (isModEnabled(
'supplier_order')) {
 
   98  require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
 
  100if (isModEnabled(
'supplier_proposal')) {
 
  101  require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
 
  103if (isModEnabled(
'tax')) {
 
  104  require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
 
  106if (isModEnabled(
'stocktransfer')) {
 
  107  require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
 
  108  require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransferline.class.php';
 
  114$langs->loadLangs(array(
'projects', 
'companies', 
'suppliers', 
'compta'));
 
  115if (isModEnabled(
'invoice')) {
 
  116  $langs->load(
"bills");
 
  118if (isModEnabled(
'order')) {
 
  119  $langs->load(
"orders");
 
  121if (isModEnabled(
"propal")) {
 
  122  $langs->load(
"propal");
 
  124if (isModEnabled(
'intervention')) {
 
  125  $langs->load(
"interventions");
 
  127if (isModEnabled(
'deplacement')) {
 
  128  $langs->load(
"trips");
 
  130if (isModEnabled(
'expensereport')) {
 
  131  $langs->load(
"trips");
 
  133if (isModEnabled(
'don')) {
 
  134  $langs->load(
"donations");
 
  136if (isModEnabled(
'loan')) {
 
  137  $langs->load(
"loan");
 
  139if (isModEnabled(
'salaries')) {
 
  140  $langs->load(
"salaries");
 
  142if (isModEnabled(
'mrp')) {
 
  145if (isModEnabled(
'eventorganization')) {
 
  146  $langs->load(
"eventorganization");
 
  154$action = 
GETPOST(
'action', 
'aZ09');
 
  155$datesrfc = 
GETPOST(
'datesrfc');  
 
  156$dateerfc = 
GETPOST(
'dateerfc');  
 
  159if (empty($dates) && !empty($datesrfc)) { 
 
  162if (empty($datee) && !empty($dateerfc)) { 
 
  165if (!GETPOSTISSET(
'datesrfc') && !GETPOSTISSET(
'datesday') && 
getDolGlobalString(
'PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) {
 
  172if ($id == 
'' && $ref == 
'') {
 
  174  header(
'Location: list.php');
 
  178$mine = 
GETPOST(
'mode') == 
'mine' ? 1 : 0;
 
  183include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php'; 
 
  184if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 
'fetchComments') && empty(
$object->comments)) {
 
  193$hookmanager->initHooks(array(
'projectOverview'));
 
  200$title = $langs->trans(
'ProjectReferers').
' - '.
$object->ref.
' '.
$object->name;
 
  202  $title = 
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
'ProjectReferers');
 
  205$help_url = 
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
 
  209$form = 
new Form($db);
 
  213$userstatic = 
new User($db);
 
  216$userAccess = 
$object->restrictedProjectArea($user);
 
  224if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
 
  225  $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
 
  226  $tmpurl = preg_replace(
'/__SOCID__/', (
string) 
$object->socid, $tmpurl);
 
  227  $linkback = 
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ? 
'&' : 
'?'). 
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
 
  229  $linkback = 
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
 
  232$morehtmlref = 
'<div class="refidno">';
 
  236if (!empty(
$object->thirdparty->id) && 
$object->thirdparty->id > 0) {
 
  237  $morehtmlref .= 
'<br>'.$object->thirdparty->getNomUrl(1, 
'project');
 
  239$morehtmlref .= 
'</div>';
 
  242if (!$user->hasRight(
'projet', 
'all', 
'lire')) {
 
  243  $objectsListId = 
$object->getProjectsAuthorizedForUser($user, 0, 0);
 
  244  $object->next_prev_filter = 
"te.rowid IN (".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) : 
'0').
")";
 
  247dol_banner_tab($object, 
'ref', $linkback, 1, 
'ref', 
'ref', $morehtmlref);
 
  250print 
'<div class="fichecenter">';
 
  251print 
'<div class="fichehalfleft">';
 
  252print 
'<div class="underbanner clearboth"></div>';
 
  254print 
'<table class="border tableforfield centpercent">';
 
  258  print 
'<tr><td class="tdtop">';
 
  259  print $langs->trans(
"Usage");
 
  263    print 
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity', 
'alpha') != 
'' ? 
' checked="checked"' : 
'') : (
$object->usage_opportunity ? 
' checked="checked"' : 
'')).
'"> ';
 
  264    $htmltext = $langs->trans(
"ProjectFollowOpportunity");
 
  265    print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
 
  269    print 
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task', 
'alpha') != 
'' ? 
' checked="checked"' : 
'') : (
$object->usage_task ? 
' checked="checked"' : 
'')).
'"> ';
 
  270    $htmltext = $langs->trans(
"ProjectFollowTasks");
 
  271    print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
 
  275    print 
'<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time', 
'alpha') != 
'' ? 
' checked="checked"' : 
'') : (
$object->usage_bill_time ? 
' checked="checked"' : 
'')).
'"> ';
 
  276    $htmltext = $langs->trans(
"ProjectBillTimeDescription");
 
  277    print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
 
  280  if (isModEnabled(
'eventorganization')) {
 
  281    print 
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event', 
'alpha') != 
'' ? 
' checked="checked"' : 
'') : (
$object->usage_organize_event ? 
' checked="checked"' : 
'')).
'"> ';
 
  282    $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
 
  283    print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
 
  289print 
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
 
  291  print 
img_picto($langs->trans(
'SharedProject'), 
'world', 
'class="paddingrightonly"');
 
  292  print $langs->trans(
'SharedProject');
 
  294  print 
img_picto($langs->trans(
'PrivateProject'), 
'private', 
'class="paddingrightonly"');
 
  295  print $langs->trans(
'PrivateProject');
 
  301  print 
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
 
  304    print $langs->trans(
"OppStatus".$code);
 
  309  print 
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
 
  310  if (!is_null(
$object->opp_percent) && strcmp(
$object->opp_percent, 
'')) {
 
  311    print 
price(
$object->opp_percent, 0, $langs, 1, 0).
' %';
 
  316  print 
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
 
  317  if (!is_null(
$object->opp_amount) && strcmp(
$object->opp_amount, 
'')) {
 
  318    print 
'<span class="amount">'.price(
$object->opp_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
 
  319    if (strcmp(
$object->opp_percent, 
'')) {
 
  320      print 
'       <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"OpportunityWeightedAmountShort").
'</span>: <span class="amount">'.
price(
$object->opp_amount * 
$object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).
'</span></span>';
 
  327print 
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
 
  328if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount, 
'')) {
 
  329  print 
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
 
  334print 
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
 
  336print($start ? $start : 
'?');
 
  339print($end ? $end : 
'?');
 
  347include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
 
  352print 
'<div class="fichehalfright">';
 
  353print 
'<div class="underbanner clearboth"></div>';
 
  355print 
'<table class="border tableforfield centpercent">';
 
  358print 
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
 
  363if (isModEnabled(
'category')) {
 
  364  print 
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
 
  365  print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
 
  374print 
'<div class="clearboth"></div>';
 
  384$listofreferent = array(
 
  386    'name' => 
"Warehouse",
 
  387    'title' => 
"ListWarehouseAssociatedProject",
 
  388    'class' => 
'Entrepot',
 
  389    'table' => 
'entrepot',
 
  390    'datefieldname' => 
'date_entrepot',
 
  391    'urlnew' => DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  392    'lang' => 
'entrepot',
 
  393    'buttonnew' => 
'AddWarehouse',
 
  394    'project_field' => 
'fk_project',
 
  395    'testnew' => $user->hasRight(
'stock', 
'creer'),
 
  396    'test' => isModEnabled(
'stock') && $user->hasRight(
'stock', 
'lire') && 
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT')
 
  399    'name' => 
"Proposals",
 
  400    'title' => 
"ListProposalsAssociatedProject",
 
  403    'datefieldname' => 
'datep',
 
  404    'urlnew' => DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  406    'buttonnew' => 
'AddProp',
 
  407    'testnew' => $user->hasRight(
'propal', 
'creer'),
 
  408    'test' => isModEnabled(
'propal') && $user->hasRight(
'propal', 
'lire')
 
  411    'name' => 
"CustomersOrders",
 
  412    'title' => 
"ListOrdersAssociatedProject",
 
  413    'class' => 
'Commande',
 
  414    'table' => 
'commande',
 
  415    'datefieldname' => 
'date_commande',
 
  416    'urlnew' => DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  418    'buttonnew' => 
'CreateOrder',
 
  419    'testnew' => $user->hasRight(
'commande', 
'creer'),
 
  420    'test' => isModEnabled(
'order') && $user->hasRight(
'commande', 
'lire')
 
  423    'name' => 
"CustomersInvoices",
 
  424    'title' => 
"ListInvoicesAssociatedProject",
 
  425    'class' => 
'Facture',
 
  427    'table' => 
'facture',
 
  428    'datefieldname' => 
'datef',
 
  429    'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  431    'buttonnew' => 
'CreateBill',
 
  432    'testnew' => $user->hasRight(
'facture', 
'creer'),
 
  433    'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture', 
'lire')
 
  435  'invoice_predefined' => array(
 
  436    'name' => 
"PredefinedInvoices",
 
  437    'title' => 
"ListPredefinedInvoicesAssociatedProject",
 
  438    'class' => 
'FactureRec',
 
  439    'table' => 
'facture_rec',
 
  440    'datefieldname' => 
'datec',
 
  441    'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  443    'buttonnew' => 
'CreateBill',
 
  444    'testnew' => $user->hasRight(
'facture', 
'creer'),
 
  445    'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture', 
'lire')
 
  447  'proposal_supplier' => array(
 
  448    'name' => 
"SupplierProposals",
 
  449    'title' => 
"ListSupplierProposalsAssociatedProject",
 
  450    'class' => 
'SupplierProposal',
 
  451    'table' => 
'supplier_proposal',
 
  452    'datefieldname' => 
'date_valid',
 
  453    'urlnew' => DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id), 
 
  454    'lang' => 
'supplier_proposal',
 
  455    'buttonnew' => 
'AddSupplierProposal',
 
  456    'testnew' => $user->hasRight(
'supplier_proposal', 
'creer'),
 
  457    'test' => isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal', 
'lire')
 
  459  'order_supplier' => array(
 
  460    'name' => 
"SuppliersOrders",
 
  461    'title' => 
"ListSupplierOrdersAssociatedProject",
 
  462    'class' => 
'CommandeFournisseur',
 
  463    'table' => 
'commande_fournisseur',
 
  464    'datefieldname' => 
'date_commande',
 
  465    'urlnew' => DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id), 
 
  466    'lang' => 
'suppliers',
 
  467    'buttonnew' => 
'AddSupplierOrder',
 
  468    'testnew' => $user->hasRight(
'fournisseur', 
'commande', 
'creer') || $user->hasRight(
'supplier_order', 
'creer'),
 
  469    'test' => isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur', 
'commande', 
'lire') || $user->hasRight(
'supplier_order', 
'lire')
 
  471  'invoice_supplier' => array(
 
  472    'name' => 
"BillsSuppliers",
 
  473    'title' => 
"ListSupplierInvoicesAssociatedProject",
 
  474    'class' => 
'FactureFournisseur',
 
  476    'table' => 
'facture_fourn',
 
  477    'datefieldname' => 
'datef',
 
  478    'urlnew' => DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id), 
 
  479    'lang' => 
'suppliers',
 
  480    'buttonnew' => 
'AddSupplierInvoice',
 
  481    'testnew' => $user->hasRight(
'fournisseur', 
'facture', 
'creer') || $user->hasRight(
'supplier_invoice', 
'creer'),
 
  482    'test' => isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur', 
'facture', 
'lire') || $user->hasRight(
'supplier_invoice', 
'lire')
 
  485    'name' => 
"Contracts",
 
  486    'title' => 
"ListContractAssociatedProject",
 
  487    'class' => 
'Contrat',
 
  488    'table' => 
'contrat',
 
  489    'datefieldname' => 
'date_contrat',
 
  490    'urlnew' => DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  491    'lang' => 
'contracts',
 
  492    'buttonnew' => 
'AddContract',
 
  493    'testnew' => $user->hasRight(
'contrat', 
'creer'),
 
  494    'test' => isModEnabled(
'contract') && $user->hasRight(
'contrat', 
'lire')
 
  496  'intervention' => array(
 
  497    'name' => 
"Interventions",
 
  498    'title' => 
"ListFichinterAssociatedProject",
 
  499    'class' => 
'Fichinter',
 
  500    'table' => 
'fichinter',
 
  501    'datefieldname' => 
'date_valid',
 
  502    'disableamount' => 0,
 
  504    'urlnew' => DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  505    'lang' => 
'interventions',
 
  506    'buttonnew' => 
'AddIntervention',
 
  507    'testnew' => $user->hasRight(
'ficheinter', 
'creer'),
 
  508    'test' => isModEnabled(
'intervention') && $user->hasRight(
'ficheinter', 
'lire')
 
  511    'name' => 
"Shippings",
 
  512    'title' => 
"ListShippingAssociatedProject",
 
  513    'class' => 
'Expedition',
 
  514    'table' => 
'expedition',
 
  515    'datefieldname' => 
'date_valid',
 
  516    'urlnew' => DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  517    'lang' => 
'sendings',
 
  518    'buttonnew' => 
'CreateShipment',
 
  520    'test' => isModEnabled(
'shipping') && $user->hasRight(
'expedition', 
'lire')
 
  524    'title' => 
"ListMOAssociatedProject",
 
  527    'datefieldname' => 
'date_valid',
 
  528    'urlnew' => DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  530    'buttonnew' => 
'CreateMO',
 
  531    'testnew' => $user->hasRight(
'mrp', 
'write'),
 
  532    'project_field' => 
'fk_project',
 
  534    'test' => isModEnabled(
'mrp') && $user->hasRight(
'mrp', 
'read')
 
  537    'name' => 
"TripsAndExpenses",
 
  538    'title' => 
"ListExpenseReportsAssociatedProject",
 
  539    'class' => 
'Deplacement',
 
  540    'table' => 
'deplacement',
 
  541    'datefieldname' => 
'dated',
 
  543    'disableamount' => 1,
 
  544    'urlnew' => DOL_URL_ROOT.
'/deplacement/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  546    'buttonnew' => 
'AddTrip',
 
  547    'testnew' => $user->hasRight(
'deplacement', 
'creer'),
 
  548    'test' => isModEnabled(
'deplacement') && $user->hasRight(
'deplacement', 
'lire')
 
  550  'expensereport' => array(
 
  551    'name' => 
"ExpenseReports",
 
  552    'title' => 
"ListExpenseReportsAssociatedProject",
 
  553    'class' => 
'ExpenseReportLine',
 
  554    'table' => 
'expensereport_det',
 
  555    'datefieldname' => 
'date',
 
  557    'disableamount' => 0,
 
  558    'urlnew' => DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  560    'buttonnew' => 
'AddTrip',
 
  561    'testnew' => $user->hasRight(
'expensereport', 
'creer'),
 
  562    'test' => isModEnabled(
'expensereport') && $user->hasRight(
'expensereport', 
'lire')
 
  565    'name' => 
"Donation",
 
  566    'title' => 
"ListDonationsAssociatedProject",
 
  570    'datefieldname' => 
'datedon',
 
  571    'disableamount' => 0,
 
  572    'urlnew' => DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  573    'lang' => 
'donations',
 
  574    'buttonnew' => 
'AddDonation',
 
  575    'testnew' => $user->hasRight(
'don', 
'creer'),
 
  576    'test' => isModEnabled(
'don') && $user->hasRight(
'don', 
'lire')
 
  580    'title' => 
"ListLoanAssociatedProject",
 
  584    'datefieldname' => 
'datestart',
 
  585    'disableamount' => 0,
 
  586    'urlnew' => DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  588    'buttonnew' => 
'AddLoan',
 
  589    'testnew' => $user->hasRight(
'loan', 
'write'),
 
  590    'test' => isModEnabled(
'loan') && $user->hasRight(
'loan', 
'read')
 
  592  'chargesociales' => array(
 
  593    'name' => 
"SocialContribution",
 
  594    'title' => 
"ListSocialContributionAssociatedProject",
 
  595    'class' => 
'ChargeSociales',
 
  597    'table' => 
'chargesociales',
 
  598    'datefieldname' => 
'date_ech',
 
  599    'disableamount' => 0,
 
  600    'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  602    'buttonnew' => 
'AddSocialContribution',
 
  603    'testnew' => $user->hasRight(
'tax', 
'charges', 
'lire'),
 
  604    'test' => isModEnabled(
'tax') && $user->hasRight(
'tax', 
'charges', 
'lire')
 
  606  'project_task' => array(
 
  607    'name' => 
"TaskTimeSpent",
 
  608    'title' => 
"ListTaskTimeUserProject",
 
  611    'table' => 
'projet_task',
 
  612    'datefieldname' => 
'element_date',
 
  613    'disableamount' => 0,
 
  614    'urlnew' => DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  615    'buttonnew' => 
'AddTimeSpent',
 
  616    'testnew' => $user->hasRight(
'project', 
'creer'),
 
  617    'test' => isModEnabled(
'project') && $user->hasRight(
'projet', 
'lire') && !
getDolGlobalString(
'PROJECT_HIDE_TASKS')
 
  619  'stock_mouvement' => array(
 
  620    'name' => 
"MouvementStockAssociated",
 
  621    'title' => 
"ListMouvementStockProject",
 
  622    'class' => 
'StockTransfer',
 
  623    'table' => 
'stocktransfer_stocktransfer',
 
  624    'datefieldname' => 
'datem',
 
  626    'project_field' => 
'fk_project',
 
  627    'disableamount' => 0,
 
  628    'test' => isModEnabled(
'stock') && $user->hasRight(
'stock', 
'mouvement', 
'lire') && 
getDolGlobalString(
'STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW')
 
  631    'name' => 
"Salaries",
 
  632    'title' => 
"ListSalariesAssociatedProject",
 
  635    'datefieldname' => 
'datesp',
 
  637    'disableamount' => 0,
 
  638    'urlnew' => DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  639    'lang' => 
'salaries',
 
  640    'buttonnew' => 
'AddSalary',
 
  641    'testnew' => $user->hasRight(
'salaries', 
'write'),
 
  642    'test' => isModEnabled(
'salaries') && $user->hasRight(
'salaries', 
'read')
 
  644  'variouspayment' => array(
 
  645    'name' => 
"VariousPayments",
 
  646    'title' => 
"ListVariousPaymentsAssociatedProject",
 
  647    'class' => 
'PaymentVarious',
 
  648    'table' => 
'payment_various',
 
  649    'datefieldname' => 
'datev',
 
  651    'disableamount' => 0,
 
  652    'urlnew' => DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
 
  654    'buttonnew' => 
'AddVariousPayment',
 
  655    'testnew' => $user->hasRight(
'banque', 
'modifier'),
 
  656    'test' => isModEnabled(
"bank") && $user->hasRight(
'banque', 
'lire') && !
getDolGlobalString(
'BANK_USE_OLD_VARIOUS_PAYMENT')
 
  676  foreach ($listofreferent as $key => $element) {
 
  677    if ($listofreferent[$key][
'margin'] == 
'add') {
 
  678      unset($listofreferent[$key][
'margin']);
 
  681  $newelementforplusmargin = explode(
',', 
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_PLUS_MARGIN'));
 
  682  foreach ($newelementforplusmargin as $value) {
 
  683    $listofreferent[trim($value)][
'margin'] = 
'add';
 
  687  foreach ($listofreferent as $key => $element) {
 
  688    if ($listofreferent[$key][
'margin'] == 
'minus') {
 
  689      unset($listofreferent[$key][
'margin']);
 
  692  $newelementforminusmargin = explode(
',', 
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_MINUS_MARGIN'));
 
  693  foreach ($newelementforminusmargin as $value) {
 
  694    $listofreferent[trim($value)][
'margin'] = 
'minus';
 
  699$parameters = array(
'listofreferent' => $listofreferent);
 
  700$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
 
  702if (!empty($hookmanager->resArray)) {
 
  703  $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
 
  706if ($action == 
"addelement") {
 
  707  $tablename = 
GETPOST(
"tablename");
 
  708  $elementselectid = 
GETPOST(
"elementselect");
 
  709  $result = 
$object->update_element($tablename, $elementselectid);
 
  713} elseif ($action == 
"unlink") {
 
  714  $tablename = 
GETPOST(
"tablename", 
"aZ09");
 
  715  $projectField = GETPOSTISSET(
'projectfield') ? 
GETPOST(
'projectfield', 
'aZ09') : 
'fk_projet';
 
  716  $elementselectid = 
GETPOSTINT(
"elementselect");
 
  718  $result = 
$object->remove_element($tablename, $elementselectid, $projectField);
 
  724$elementuser = 
new User($db);
 
  730if (!$showdatefilter) {
 
  731  print 
'<div class="center centpercent">';
 
  732  print 
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
 
  733  print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  734  print 
'<input type="hidden" name="tablename" value="'.(empty($tablename) ? 
'' : $tablename).
'">';
 
  735  print 
'<input type="hidden" name="action" value="view">';
 
  736  print 
'<div class="inline-block">';
 
  737  print $form->selectDate($dates, 
'dates', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
"From"));
 
  739  print 
'<div class="inline-block">';
 
  740  print $form->selectDate($datee, 
'datee', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
"to"));
 
  742  print 
'<div class="inline-block">';
 
  743  print 
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
 
  755$langs->loadLangs(array(
"suppliers", 
"bills", 
"orders", 
"proposals", 
"margins"));
 
  757if (isModEnabled(
'stock')) {
 
  758  $langs->load(
'stocks');
 
  763print 
'<table class="noborder centpercent">';
 
  764print 
'<tr class="liste_titre">';
 
  765print 
'<td class="left" width="200">';
 
  766$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
 
  767$tooltiponprofitplus = $tooltiponprofitminus = 
'';
 
  768foreach ($listofreferent as $key => $value) {
 
  769  if (!empty($value[
'lang'])) {
 
  770    $langs->load($value[
'lang']);
 
  772  $name = $langs->trans($value[
'name']);
 
  773  $qualified = $value[
'test'];
 
  774  $margin = empty($value[
'margin']) ? 
'' : $value[
'margin'];
 
  775  if ($qualified && isset($margin)) {   
 
  776    if ($margin === 
'add') {
 
  777      $tooltiponprofitplus .= 
' > '.$name.
" (+)<br>\n";
 
  779    if ($margin === 
'minus') {
 
  780      $tooltiponprofitminus .= 
' > '.$name.
" (-)<br>\n";
 
  784$tooltiponprofit .= $tooltiponprofitplus;
 
  785$tooltiponprofit .= $tooltiponprofitminus;
 
  786print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
 
  788print 
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
 
  789print 
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
 
  790print 
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
 
  793$total_revenue_ht = 0;
 
  798foreach ($listofreferent as $key => $value) {
 
  800    'total_revenue_ht' => & $total_revenue_ht,
 
  801    'balance_ht' => & $balance_ht,
 
  802    'balance_ttc' => & $balance_ttc,
 
  808  $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action); 
 
  811  } elseif ($reshook > 0) {
 
  812    print $hookmanager->resPrint;
 
  816  $name = $langs->trans($value[
'name']);
 
  817  $title = $value[
'title'];
 
  818  $classname = $value[
'class'];
 
  819  $tablename = $value[
'table'];
 
  820  $datefieldname = $value[
'datefieldname'];
 
  821  $qualified = $value[
'test'];
 
  822  $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
 
  823  $project_field = empty($value[
'project_field']) ? 
'' : $value[
'project_field'];
 
  824  if ($qualified && isset($margin)) {   
 
  825    $element = 
new $classname($db);
 
  827    $elementarray = 
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 
'fk_projet');
 
  829    if (is_array($elementarray) && count($elementarray) > 0) {
 
  834      $num = count($elementarray);
 
  835      for ($i = 0; $i < $num; $i++) {
 
  836        $tmp = explode(
'_', $elementarray[$i]);
 
  837        $idofelement = $tmp[0];
 
  838        $idofelementuser = !empty($tmp[1]) ? $tmp[1] : 
"";
 
  840        $element->fetch($idofelement);
 
  841        if ($idofelementuser) {
 
  842          $elementuser->fetch($idofelementuser);
 
  846        $qualifiedfortotal = 
true;
 
  847        if ($key == 
'invoice') {
 
  848          if (!empty($element->close_code) && $element->close_code == 
'replaced') {
 
  849            $qualifiedfortotal = 
false; 
 
  852            $qualifiedfortotal = 
false; 
 
  855        if ($key == 
'propal') {
 
  857            $qualifiedfortotal = 
false; 
 
  861        if ($tablename != 
'expensereport_det' && method_exists($element, 
'fetch_thirdparty')) {
 
  862          $element->fetch_thirdparty();
 
  866        if ($tablename == 
'don' || $tablename == 
'chargesociales' || $tablename == 
'payment_various' || $tablename == 
'salary') {
 
  867          $total_ht_by_line = $element->amount;
 
  868        } elseif ($tablename == 
'fichinter') {
 
  869          $total_ht_by_line = $element->getAmount();
 
  870        } elseif ($tablename == 
'stock_mouvement') {
 
  871          $total_ht_by_line = $element->price * abs($element->qty);
 
  872        } elseif ($tablename == 
'projet_task') {
 
  873          $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser : 
'', $dates, $datee);
 
  874          $total_ht_by_line = 
price2num($tmp[
'amount'], 
'MT');
 
  875        } elseif ($key == 
'loan') {
 
  876          if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
 
  878            $total_ht_by_line = -$element->capital;
 
  881            $total_ht_by_line = 0;
 
  883            $loanScheduleStatic->fetchAll($element->id);
 
  884            if (!empty($loanScheduleStatic->lines)) {
 
  885              foreach ($loanScheduleStatic->lines as $loanSchedule) {
 
  889                if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee) 
 
  890                  || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <= 
dol_now()
 
  891                  || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
 
  893                  $total_ht_by_line -= $loanSchedule->amount_capital;
 
  899          $total_ht_by_line = $element->total_ht;
 
  903        if ($tablename == 
'don' || $tablename == 
'chargesociales' || $tablename == 
'payment_various' || $tablename == 
'salary') {
 
  904          $total_ttc_by_line = $element->amount;
 
  905        } elseif ($tablename == 
'fichinter') {
 
  906          $total_ttc_by_line = $element->getAmount();
 
  907        } elseif ($tablename == 
'stock_mouvement') {
 
  908          $total_ttc_by_line = $element->price * abs($element->qty);
 
  909        } elseif ($tablename == 
'projet_task') {
 
  912          if (preg_replace(
'/^(\d+\.)\s\(.*\)/', $defaultvat, $reg)) {
 
  913            $defaultvat = $reg[1];
 
  915          $total_ttc_by_line = 
price2num($total_ht_by_line * (1 + ((
float) $defaultvat / 100)), 
'MT');
 
  916        } elseif ($key == 
'loan') {
 
  917          $total_ttc_by_line = $total_ht_by_line; 
 
  919          $total_ttc_by_line = $element->total_ttc;
 
  923        if ($tablename == 
'payment_various') {
 
  924          if ($element->sens == 1) {
 
  925            $total_ht_by_line = -$total_ht_by_line;
 
  926            $total_ttc_by_line = -$total_ttc_by_line;
 
  931        if ($tablename == 
'commande_fournisseur' || $tablename == 
'supplier_proposal') {
 
  932          $total_ht_by_line = -$total_ht_by_line;
 
  933          $total_ttc_by_line = -$total_ttc_by_line;
 
  937        if ($qualifiedfortotal) {
 
  938          $total_ht = $total_ht + $total_ht_by_line;
 
  939          $total_ttc = $total_ttc + $total_ttc_by_line;
 
  947        if ($margin === 
'add') {
 
  948          $total_revenue_ht += $total_ht;
 
  951        if ($margin === 
"minus") {  
 
  952          $total_ht = -$total_ht;
 
  953          $total_ttc = -$total_ttc;
 
  956        $balance_ht += $total_ht;
 
  957        $balance_ttc += $total_ttc;
 
  960      print 
'<tr class="oddeven">';
 
  962      print 
'<td class="left">'.$name.
'</td>';
 
  964      print 
'<td class="right">'.$i.
'</td>';
 
  966      print 
'<td class="right">';
 
  967      if ($key == 
'intervention' && !$margin) {
 
  968        print 
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
 
  970        if ($key == 
'propal') {
 
  971          print 
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
 
  973        print 
price($total_ht);
 
  977      print 
'<td class="right">';
 
  978      if ($key == 
'intervention' && !$margin) {
 
  979        print 
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
 
  981        if ($key == 
'propal') {
 
  982          print 
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
 
  984        print 
price($total_ttc);
 
  992print 
'<tr class="liste_total">';
 
  993print 
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
 
  994print 
'<td class="right">'.price(
price2num($balance_ht, 
'MT')).
'</td>';
 
  995print 
'<td class="right">'.price(
price2num($balance_ttc, 
'MT')).
'</td>';
 
  999if (
$object->usage_organize_event) {
 
 1000  require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
 
 1002  $result = $conforboothattendee->fetchAll(
'', 
'', 0, 0, 
'(t.fk_project:=:'.((
int) 
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
 
 1004  if (!is_array($result) && $result < 0) {
 
 1005    setEventMessages($conforboothattendee->error, $conforboothattendee->errors, 
'errors');
 
 1007    $nbAttendees = count($result);
 
 1010  if ($nbAttendees >= 2) {
 
 1011    $costperattendee_ht = $balance_ht / $nbAttendees;
 
 1012    $costperattendee_ttc = $balance_ttc / $nbAttendees;
 
 1013    print 
'<tr class="liste_total">';
 
 1014    print 
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
 
 1015    print 
'<td class="right">'.price(
price2num($costperattendee_ht, 
'MT')).
'</td>';
 
 1016    print 
'<td class="right">'.price(
price2num($costperattendee_ttc, 
'MT')).
'</td>';
 
 1022if ($total_revenue_ht) {
 
 1023  print 
'<tr class="liste_total">';
 
 1024  print 
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
 
 1025  print 
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
 
 1026  print 
'<td class="right"></td>';
 
 1040foreach ($listofreferent as $key => $value) {
 
 1041  $parameters = array(
 
 1043    'value' => & $value,
 
 1047  $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action); 
 
 1050  } elseif ($reshook > 0) {
 
 1051    print $hookmanager->resPrint;
 
 1055  $title = $value[
'title'];
 
 1056  $classname = $value[
'class'];
 
 1057  $tablename = $value[
'table'];
 
 1058  $datefieldname = $value[
'datefieldname'];
 
 1059  $qualified = $value[
'test'];
 
 1060  $urlnew = empty($value[
'urlnew']) ? 
'' : $value[
'urlnew'];
 
 1061  $buttonnew = empty($value[
'buttonnew']) ? 
'' : $value[
'buttonnew'];
 
 1062  $testnew = empty($value[
'testnew']) ? 
'' : $value[
'testnew'];
 
 1063  $project_field = empty($value[
'project_field']) ? 
'' : $value[
'project_field'];
 
 1064  $nototal = empty($value[
'nototal']) ? 0 : 1;
 
 1066  $exclude_select_element = array(
'payment_various');
 
 1067  if (!empty($value[
'exclude_select_element'])) {
 
 1068    $exclude_select_element[] = $value[
'exclude_select_element'];
 
 1075    $element = 
new $classname($db);
 
 1079    $idtofilterthirdparty = 0;
 
 1080    $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn', 
'commande_fournisseur');
 
 1081    if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
 
 1082      $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 : 
$object->thirdparty->id;
 
 1084        $idtofilterthirdparty .= 
',' . 
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
 
 1088    $elementarray = 
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 
'fk_projet');
 
 1091    if (!
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
 
 1092      $selectList = $formproject->select_element($tablename, $idtofilterthirdparty, 
'minwidth300 minwidth75imp', -2, empty($project_field) ? 
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
 
 1093      if ($selectList < 0) {
 
 1095      } elseif ($selectList) {
 
 1097        $addform .= 
'<div class="inline-block valignmiddle">';
 
 1098        $addform .= 
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
 
 1099        $addform .= 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
 1100        $addform .= 
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
 
 1101        $addform .= 
'<input type="hidden" name="action" value="addelement">';
 
 1102        $addform .= 
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates, 
'dayhourrfc').
'">';
 
 1103        $addform .= 
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee, 
'dayhourrfc').
'">';
 
 1104        $addform .= 
'<table><tr>';
 
 1106        $addform .= 
'<td>'.$selectList.
'</td>';
 
 1107        $addform .= 
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
 
 1108        $addform .= 
'</tr></table>';
 
 1109        $addform .= 
'</form>';
 
 1110        $addform .= 
'</div>';
 
 1114      $addform .= 
'<div class="inline-block valignmiddle">';
 
 1116        $addform .= 
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
 
 1118        $addform .= 
'<span title="'.dol_escape_htmltag($langs->trans($buttonnew)).
'"><a class="buttonxxx marginleftonly buttonRefused" disabled="disabled" href="#"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a></span>';
 
 1120      $addform .= 
'<div>';
 
 1123    if (is_array($elementarray) && count($elementarray) > 0 && $key == 
"order_supplier") {
 
 1124      $addform = 
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;"> 
 1125             <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span> 
 1128             $("#btnShow").on("click", function () { 
 1129              console.log("We click to show or hide the canceled lines"); 
 1130              var attr = $(this).attr("data-canceledarehidden"); 
 1131              if (typeof attr !== "undefined" && attr !== false) { 
 1132                console.log("Show canceled"); 
 1133                $(".tr_canceled").show(); 
 1134                $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'"); 
 1135                $("#btnShow").removeAttr("data-canceledarehidden"); 
 1136                $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye"); 
 1138                console.log("Hide canceled"); 
 1139                $(".tr_canceled").hide(); 
 1140                $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'"); 
 1141                $("#btnShow").attr("data-canceledarehidden", 1); 
 1142                $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash"); 
 1145             </script></div> '.$addform;
 
 1150    print 
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
 
 1151    print 
'<div class="div-table-responsive">';
 
 1152    print 
'<table class="noborder centpercent">';
 
 1154    print 
'<tr class="liste_titre">';
 
 1156    print 
'<td style="width: 24px"></td>';
 
 1158    print 
'<td'.(($tablename != 
'actioncomm' && $tablename != 
'projet_task') ? 
' style="width: 200px"' : 
'').
'>'.$langs->trans(
"Ref").
'</td>';
 
 1160    if (
'MouvementStock' == $classname) {
 
 1161      print 
'<td style="width: 200px">'.$langs->trans(
"Product").
'</td>';
 
 1162      print 
'<td style="width: 50px">'.$langs->trans(
"Qty").
'</td>';
 
 1165    print 
'<td'.(($tablename != 
'actioncomm' && $tablename != 
'projet_task') ? 
' style="width: 200px"' : 
'').
' class="center">';
 
 1166    if (in_array($tablename, array(
'projet_task'))) {
 
 1167      print $langs->trans(
"TimeSpent");
 
 1169    if (!in_array($tablename, array(
'projet_task'))) {
 
 1170      print $langs->trans(
"Date");
 
 1175    if (in_array($tablename, array(
'projet_task')) && $key == 
'project_task') {
 
 1177    } elseif (in_array($tablename, array(
'payment_various'))) {
 
 1179    } elseif (in_array($tablename, array(
'expensereport_det', 
'don', 
'projet_task', 
'stock_mouvement', 
'salary'))) {
 
 1180      print $langs->trans(
"User");
 
 1182      print $langs->trans(
"ThirdParty");
 
 1186    if ($tablename == 
'fichinter') {
 
 1188      print $langs->trans(
"TotalDuration");
 
 1189      $total_duration = 0;
 
 1195    if ($key == 
'loan') {
 
 1196      print 
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
 
 1197    } elseif (empty($value[
'disableamount'])) {
 
 1198      print 
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
 
 1200      print 
'<td width="120"></td>';
 
 1204    if ($key == 
'loan') {
 
 1205      print 
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
 
 1206    } elseif (empty($value[
'disableamount'])) {
 
 1207      print 
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
 
 1209      print 
'<td width="120"></td>';
 
 1212    if (in_array($tablename, array(
'projet_task'))) {
 
 1213      print 
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
 
 1215      print 
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
 
 1219    if (is_array($elementarray) && count($elementarray) > 0) {
 
 1223      $total_ht_by_third = 0;
 
 1224      $total_ttc_by_third = 0;
 
 1226      $saved_third_id = 0;
 
 1234      $num = count($elementarray);
 
 1236      for ($i = 0; $i < $num; $i++) {
 
 1237        $tmp = explode(
'_', $elementarray[$i]);
 
 1238        $idofelement = $tmp[0];
 
 1239        $idofelementuser = isset($tmp[1]) ? $tmp[1] : 
"";
 
 1241        $element->fetch($idofelement);
 
 1242        if ($idofelementuser) {
 
 1243          $elementuser->fetch($idofelementuser);
 
 1247        if ($tablename != 
'expensereport_det') {
 
 1248          if (method_exists($element, 
'fetch_thirdparty')) {
 
 1249            $element->fetch_thirdparty();
 
 1253          $expensereport->fetch($element->fk_expensereport);
 
 1258        if ($breakline && $saved_third_id != $element->thirdparty->id) {
 
 1261          $saved_third_id = $element->thirdparty->id;
 
 1264          $total_ht_by_third = 0;
 
 1265          $total_ttc_by_third = 0;
 
 1268        $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
 
 1270        $qualifiedfortotal = 
true;
 
 1271        if ($key == 
'invoice') {
 
 1272          if (!empty($element->close_code) && $element->close_code == 
'replaced') {
 
 1273            $qualifiedfortotal = 
false; 
 
 1275        } elseif ($key == 
'order_supplier' && ($element->status == 6 || $element->status == 7)) {
 
 1276          $qualifiedfortotal = 
false; 
 
 1279        if ($key == 
"order_supplier" && ($element->status == 6 || $element->status == 7)) {
 
 1280          print 
'<tr class="oddeven tr_canceled">';
 
 1282          print 
'<tr class="oddeven" >';
 
 1287        print 
'<td style="width: 24px">';
 
 1288        if ($tablename != 
'projet_task' && $tablename != 
'stock_mouvement') {
 
 1290            print 
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ? 
'&projectfield='.$project_field : 
'').
'" class="reposition">';
 
 1291            print 
img_picto($langs->trans(
'Unlink'), 
'unlink');
 
 1298        print 
'<td class="left nowraponall">';
 
 1299        if ($tablename == 
'expensereport_det') {
 
 1300          print $expensereport->getNomUrl(1);
 
 1302          print 
'<table><tr><td style="border-bottom: none;">';
 
 1304          if ($element instanceof 
Task) {
 
 1305            print $element->getNomUrl(1, 
'withproject', 
'time');
 
 1306            print 
' - '.dol_trunc($element->label, 48);
 
 1307          } elseif ($key == 
'loan') {
 
 1308            print $element->getNomUrl(1);
 
 1309            print 
' - '.dol_trunc($element->label, 48);
 
 1311            print $element->getNomUrl(1);
 
 1314          $element_doc = $element->element;
 
 1316          if (!empty($conf->$element_doc)) {
 
 1317            $confelementdoc = $conf->$element_doc;
 
 1318            $filedir = $confelementdoc->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
 
 1323          if ($element_doc === 
'order_supplier') {
 
 1324            $element_doc = 
'commande_fournisseur';
 
 1325            $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
 
 1326          } elseif ($element_doc === 
'invoice_supplier') {
 
 1327            $element_doc = 
'facture_fournisseur';
 
 1328            $filename = 
get_exdir($element->id, 2, 0, 0, $element, 
'invoice_supplier').dol_sanitizeFileName($element->ref);
 
 1329            $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].
'/'.$filename;
 
 1332          print 
'<div class="inline-block valignmiddle">';
 
 1334            print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
 
 1340          print 
'<td class="tdoverflowmax250" style="border-bottom: none;">';
 
 1343          if (!empty($element->ref_supplier)) {
 
 1344            print 
' - '.$element->ref_supplier;
 
 1347          if (!empty($element->ref_customer)) {
 
 1348            print 
' - '.$element->ref_customer;
 
 1351          if (empty($element->ref_customer) && !empty($element->ref_client)) {
 
 1352            print 
' - '.$element->ref_client;
 
 1355          print 
'</td></tr></table>';
 
 1359        if (
'MouvementStock' == $classname) {
 
 1360          $mvsProd = 
new Product($element->db);
 
 1361          $mvsProd->fetch($element->product_id);
 
 1362          print 
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
 
 1363          print 
'<td>'.$element->qty.
'</td>';
 
 1367        $total_time_by_line = 
null;
 
 1368        if ($tablename == 
'expensereport_det') {
 
 1369          $date = $element->date; 
 
 1370        } elseif ($tablename == 
'stock_mouvement') {
 
 1371          $date = $element->datem;
 
 1372        } elseif ($tablename == 
'salary') {
 
 1373          $date = $element->datesp;
 
 1374        } elseif ($tablename == 
'payment_various') {
 
 1375          $date = $element->datev;
 
 1376        } elseif ($tablename == 
'chargesociales') {
 
 1377          $date = $element->date_ech;
 
 1378        } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
 
 1379          if ($tablename == 
'don') {
 
 1380            $date = $element->datedon;
 
 1382          if ($tablename == 
'commande_fournisseur' || $tablename == 
'supplier_order') {
 
 1383            $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
 
 1384          } elseif ($tablename == 
'supplier_proposal') {
 
 1385            $date = $element->date_validation; 
 
 1386          } elseif ($tablename == 
'fichinter') {
 
 1387            $date = $element->datev; 
 
 1388          } elseif ($tablename == 
'projet_task') {
 
 1391            $date = $element->date; 
 
 1393              $date = $element->date_contrat;
 
 1396              $date = $element->datev;
 
 1398            if (empty($date) && !empty($datefieldname)) {
 
 1399              $date = $element->$datefieldname;
 
 1402        } elseif ($key == 
'loan') {
 
 1403          $date = $element->datestart;
 
 1406        print 
'<td class="center">';
 
 1407        if ($tablename == 
'actioncomm') {
 
 1409          if ($element->datef && $element->datef > $element->datep) {
 
 1410            print 
" - ".dol_print_date($element->datef, 
'dayhour');
 
 1412        } elseif (in_array($tablename, array(
'projet_task'))) {
 
 1413          $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser : 
'', $dates, $datee); 
 
 1414          print 
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
 
 1417          $total_time_by_line = $tmpprojtime[
'nbseconds'];
 
 1424        print 
'<td class="tdoverflowmax150">';
 
 1425        if (is_object($element->thirdparty)) {
 
 1426          print $element->thirdparty->getNomUrl(1, 
'', 48);
 
 1427        } elseif ($tablename == 
'expensereport_det') {
 
 1428          $tmpuser = 
new User($db);
 
 1429          $tmpuser->fetch($expensereport->fk_user_author);
 
 1430          print $tmpuser->getNomUrl(1, 
'', 48);
 
 1431        } elseif ($tablename == 
'salary') {
 
 1432          $tmpuser = 
new User($db);
 
 1433          $tmpuser->fetch($element->fk_user);
 
 1434          print $tmpuser->getNomUrl(1, 
'', 48);
 
 1435        } elseif ($tablename == 
'don' || $tablename == 
'stock_mouvement') {
 
 1436          if ($element->fk_user_author > 0) {
 
 1437            $tmpuser2 = 
new User($db);
 
 1438            $tmpuser2->fetch($element->fk_user_author);
 
 1439            print $tmpuser2->getNomUrl(1, 
'', 48);
 
 1441        } elseif ($tablename == 
'projet_task' && $key == 
'element_time') {  
 
 1442          print $elementuser->getNomUrl(1);
 
 1447        if ($tablename == 
'fichinter') {
 
 1449          print 
convertSecondToTime($element->duration, 
'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
 
 1450          $total_duration += $element->duration;
 
 1456        if (empty($value[
'disableamount'])) {
 
 1457          $total_ht_by_line = 
null;
 
 1459          if ($tablename == 
'don' || $tablename == 
'chargesociales' || $tablename == 
'payment_various' || $tablename == 
'salary') {
 
 1460            $total_ht_by_line = $element->amount;
 
 1461          } elseif ($tablename == 
'fichinter') {
 
 1462            $total_ht_by_line = $element->getAmount();
 
 1463          } elseif ($tablename == 
'stock_mouvement') {
 
 1464            $total_ht_by_line = $element->price * abs($element->qty);
 
 1465          } elseif (in_array($tablename, array(
'projet_task'))) {
 
 1466            if (isModEnabled(
'salaries')) {
 
 1468              $total_ht_by_line = 
price2num($tmpprojtime[
'amount'], 
'MT');
 
 1469              if ($tmpprojtime[
'nblinesnull'] > 0) {
 
 1470                $langs->load(
"errors");
 
 1471                $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate", $conf->currency);
 
 1474              $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
 
 1476          } elseif ($key == 
'loan') {
 
 1477            $total_ht_by_line = $element->capital;
 
 1479            $total_ht_by_line = $element->total_ht;
 
 1483          if ($tablename == 
'payment_various') {
 
 1484            if ($element->sens == 0) {
 
 1485              $total_ht_by_line = -$total_ht_by_line;
 
 1489          print 
'<td class="right">';
 
 1490          if ($othermessage) {
 
 1491            print 
'<span class="opacitymedium">'.$othermessage.
'</span>';
 
 1493          if (isset($total_ht_by_line)) {
 
 1494            if (!$qualifiedfortotal) {
 
 1497            print 
'<span class="amount">'.price($total_ht_by_line).
'</span>';
 
 1498            if (!$qualifiedfortotal) {
 
 1503            print 
' '.img_warning($warning);
 
 1511        if (empty($value[
'disableamount'])) {
 
 1512          $total_ttc_by_line = 
null;
 
 1513          if ($tablename == 
'don' || $tablename == 
'chargesociales' || $tablename == 
'payment_various' || $tablename == 
'salary') {
 
 1514            $total_ttc_by_line = $element->amount;
 
 1515          } elseif ($tablename == 
'fichinter') {
 
 1516            $total_ttc_by_line = $element->getAmount();
 
 1517          } elseif ($tablename == 
'stock_mouvement') {
 
 1518            $total_ttc_by_line = $element->price * abs($element->qty);
 
 1519          } elseif ($tablename == 
'projet_task') {
 
 1520            if (isModEnabled(
'salaries')) {
 
 1523              $total_ttc_by_line = 
price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 
'MT');
 
 1525              $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
 
 1527          } elseif ($key == 
'loan') {
 
 1528            $total_ttc_by_line = $element->capital - $element->getSumPayment();
 
 1530            $total_ttc_by_line = $element->total_ttc;
 
 1534          if ($tablename == 
'payment_various') {
 
 1535            if ($element->sens == 0) {
 
 1536              $total_ttc_by_line = -$total_ttc_by_line;
 
 1540          print 
'<td class="right">';
 
 1541          if ($othermessage) {
 
 1542            print $othermessage;
 
 1544          if (isset($total_ttc_by_line)) {
 
 1545            if (!$qualifiedfortotal) {
 
 1548            print 
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
 
 1549            if (!$qualifiedfortotal) {
 
 1554            print 
' '.img_warning($warning);
 
 1562        print 
'<td class="right">';
 
 1563        if ($tablename == 
'expensereport_det') {
 
 1564          print $expensereport->getLibStatut(5);
 
 1567          print $element->getLibStatut(5, $element->getSommePaiement());
 
 1568        } elseif ($element instanceof 
Task) {
 
 1569          if ($element->progress != 
'') {
 
 1570            print $element->progress.
' %';
 
 1572        } elseif ($tablename == 
'stock_mouvement') {
 
 1573          print $element->getLibStatut(3);
 
 1575          print $element->getLibStatut(5);
 
 1581        if ($qualifiedfortotal) {
 
 1582          $total_ht = $total_ht + $total_ht_by_line;
 
 1583          $total_ttc = $total_ttc + $total_ttc_by_line;
 
 1585          $total_ht_by_third += $total_ht_by_line;
 
 1586          $total_ttc_by_third += $total_ttc_by_line;
 
 1588          if (!isset($total_time)) {
 
 1589            $total_time = $total_time_by_line;
 
 1591            $total_time += $total_time_by_line;
 
 1596          $breakline = 
'<tr class="liste_total liste_sub_total">';
 
 1597          $breakline .= 
'<td colspan="2">';
 
 1598          $breakline .= 
'</td>';
 
 1599          $breakline .= 
'<td>';
 
 1600          $breakline .= 
'</td>';
 
 1601          $breakline .= 
'<td class="right">';
 
 1602          $breakline .= $langs->trans(
'SubTotal').
' : ';
 
 1603          if (is_object($element->thirdparty)) {
 
 1604            $breakline .= $element->thirdparty->getNomUrl(0, 
'', 48);
 
 1606          $breakline .= 
'</td>';
 
 1607          $breakline .= 
'<td class="right">'.price($total_ht_by_third).
'</td>';
 
 1608          $breakline .= 
'<td class="right">'.price($total_ttc_by_third).
'</td>';
 
 1609          $breakline .= 
'<td></td>';
 
 1610          $breakline .= 
'</tr>';
 
 1621      if (empty($nototal)) {
 
 1623        if (in_array($tablename, array(
'projet_task'))) {
 
 1627        print 
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
 
 1628        if (in_array($tablename, array(
'projet_task'))) {
 
 1629          print 
'<td class="center">';
 
 1638        if ($tablename == 
'fichinter') {
 
 1639          print 
'<td class="left">'.convertSecondToTime($total_duration, 
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
 
 1641        print 
'<td class="right">';
 
 1642        if (empty($value[
'disableamount'])) {
 
 1643          if ($key == 
'loan') {
 
 1644            print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
 
 1645          } elseif ($tablename != 
'projet_task' || isModEnabled(
'salaries')) {
 
 1646            print 
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
 
 1652        print 
'<td class="right">';
 
 1653        if (empty($value[
'disableamount'])) {
 
 1654          if ($key == 
'loan') {
 
 1655            print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
 
 1656          } elseif ($tablename != 
'projet_task' || isModEnabled(
'salaries')) {
 
 1657            print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
 
 1661        print 
'<td> </td>';
 
 1665      if (!is_array($elementarray)) { 
 
 1666        print 
'<tr><td>'.$elementarray.
'</td></tr>';
 
 1669        if ($tablename == 
'fichinter') {
 
 1672        print 
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
 
 1682if ($conf->use_javascript_ajax) {
 
 1683  include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
 
 1686  print $comboenhancement;
 
 1708  return in_array($tablename, array(
'facture_fourn', 
'commande_fournisseur'));
 
 
 1719  global $db, $classname;
 
 1721  $element = 
new $classname($db);
 
 1723  $clientname = array();
 
 1724  foreach ($elementarray as $key => $id) {  
 
 1725    if (empty($clientname[$id])) {
 
 1726      $element->fetch($id);
 
 1727      $element->fetch_thirdparty();
 
 1729      $clientname[$id] = $element->thirdparty->name;
 
 1736  $elementarray = array();
 
 1737  foreach ($clientname as $id => $name) {
 
 1738    $elementarray[] = $id;
 
 1741  return $elementarray;
 
 
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Superclass for invoices classes.
Class for ConferenceOrBoothAttendee.
Class to manage Trips and Expenses.
const TYPE_DEPOSIT
Deposit invoice.
Class to manage Schedule of loans.
Class to manage products or services.
Class to manage projects.
const STATUS_SIGNED
Signed quote.
const STATUS_BILLED
Billed or processed quote.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
sortElementsByClientName($elementarray)
sortElementsByClientName
canApplySubtotalOn($tablename)
Return if we should do a group by customer with sub-total.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.