dolibarr  13.0.2
element.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2015-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
7  * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
8  * Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
37 if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
38 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
39 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
40 if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
41 if (!empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
42 if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
43 if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
44 if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
45 if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
46 if (!empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
47 if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
48 if (!empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
49 if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
50 if (!empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
51 if (!empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
52 if (!empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
53 if (!empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
54 if (!empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
55 if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
56 if (!empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
57 if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
58 if (!empty($conf->mrp->enabled)) require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
59 
60 // Load translation files required by the page
61 $langs->loadLangs(array('projects', 'companies', 'suppliers', 'compta'));
62 if (!empty($conf->facture->enabled)) $langs->load("bills");
63 if (!empty($conf->commande->enabled)) $langs->load("orders");
64 if (!empty($conf->propal->enabled)) $langs->load("propal");
65 if (!empty($conf->ficheinter->enabled)) $langs->load("interventions");
66 if (!empty($conf->deplacement->enabled)) $langs->load("trips");
67 if (!empty($conf->expensereport->enabled)) $langs->load("trips");
68 if (!empty($conf->don->enabled)) $langs->load("donations");
69 if (!empty($conf->loan->enabled)) $langs->load("loan");
70 if (!empty($conf->salaries->enabled)) $langs->load("salaries");
71 if (!empty($conf->mrp->enabled)) $langs->load("mrp");
72 
73 $id = GETPOST('id', 'int');
74 $ref = GETPOST('ref', 'alpha');
75 $action = GETPOST('action', 'aZ09');
76 $datesrfc = GETPOST('datesrfc');
77 $dateerfc = GETPOST('dateerfc');
78 $dates = dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear'));
79 $datee = dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear'));
80 if (empty($dates) && !empty($datesrfc)) $dates = dol_stringtotime($datesrfc);
81 if (empty($datee) && !empty($dateerfc)) $datee = dol_stringtotime($dateerfc);
82 if (!GETPOSTISSET('datesrfc') && !GETPOSTISSET('datesday') && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR)) {
83  $new = dol_now();
84  $tmp = dol_getdate($new);
85  //$datee=$now
86  //$dates=dol_time_plus_duree($datee, -1, 'y');
87  $dates = dol_get_first_day($tmp['year'], 1);
88 }
89 if ($id == '' && $ref == '')
90 {
91  setEventMessage($langs->trans('ErrorBadParameters'), 'errors');
92  header('Location: list.php');
93  exit();
94 }
95 
96 $mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
97 //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
98 
99 $object = new Project($db);
100 
101 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
102 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
103 
104 // Security check
105 $socid = $object->socid;
106 //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
107 $result = restrictedArea($user, 'projet', $object->id, 'projet&project');
108 
109 $hookmanager->initHooks(array('projectOverview'));
110 
111 
112 /*
113  * View
114  */
115 
116 $title = $langs->trans("ProjectReferers").' - '.$object->ref.' '.$object->name;
117 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("ProjectReferers");
118 $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
119 llxHeader("", $langs->trans("Referers"), $help_url);
120 
121 $form = new Form($db);
122 $formproject = new FormProjets($db);
123 $formfile = new FormFile($db);
124 
125 $userstatic = new User($db);
126 
127 // To verify role of users
128 $userAccess = $object->restrictedProjectArea($user);
129 
130 $head = project_prepare_head($object);
131 print dol_get_fiche_head($head, 'element', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
132 
133 
134 // Project card
135 
136 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
137 
138 $morehtmlref = '<div class="refidno">';
139 // Title
140 $morehtmlref .= $object->title;
141 // Thirdparty
142 if ($object->thirdparty->id > 0)
143 {
144  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
145 }
146 $morehtmlref .= '</div>';
147 
148 // Define a complementary filter for search of next/prev ref.
149 if (!$user->rights->projet->all->lire)
150 {
151  $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
152  $object->next_prev_filter = " te.rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
153 }
154 
155 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
156 
157 
158 print '<div class="fichecenter">';
159 print '<div class="fichehalfleft">';
160 print '<div class="underbanner clearboth"></div>';
161 
162 print '<table class="border tableforfield centpercent">';
163 
164 // Usage
165 print '<tr><td class="tdtop">';
166 print $langs->trans("Usage");
167 print '</td>';
168 print '<td>';
169 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
170 {
171  print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
172  $htmltext = $langs->trans("ProjectFollowOpportunity");
173  print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
174  print '<br>';
175 }
176 if (empty($conf->global->PROJECT_HIDE_TASKS))
177 {
178  print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
179  $htmltext = $langs->trans("ProjectFollowTasks");
180  print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
181  print '<br>';
182 }
183 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
184 {
185  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"' : '')).'"> ';
186  $htmltext = $langs->trans("ProjectBillTimeDescription");
187  print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
188  print '<br>';
189 }
190 print '</td></tr>';
191 
192 // Visibility
193 print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
194 if ($object->public) print $langs->trans('SharedProject');
195 else print $langs->trans('PrivateProject');
196 print '</td></tr>';
197 
198 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
199 {
200  // Opportunity status
201  print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
202  $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
203  if ($code) print $langs->trans("OppStatus".$code);
204  print '</td></tr>';
205 
206  // Opportunity percent
207  print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
208  if (strcmp($object->opp_percent, '')) print price($object->opp_percent, '', $langs, 1, 0).' %';
209  print '</td></tr>';
210 
211  // Opportunity Amount
212  print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
213  if (strcmp($object->opp_amount, '')) print price($object->opp_amount, '', $langs, 1, 0, 0, $conf->currency);
214  print '</td></tr>';
215 }
216 
217 // Date start - end
218 print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
219 $start = dol_print_date($object->date_start, 'day');
220 print ($start ? $start : '?');
221 $end = dol_print_date($object->date_end, 'day');
222 print ' - ';
223 print ($end ? $end : '?');
224 if ($object->hasDelay()) print img_warning("Late");
225 print '</td></tr>';
226 
227 // Budget
228 print '<tr><td>'.$langs->trans("Budget").'</td><td>';
229 if (strcmp($object->budget_amount, '')) print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
230 print '</td></tr>';
231 
232 // Other attributes
233 $cols = 2;
234 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
235 
236 print '</table>';
237 
238 print '</div>';
239 print '<div class="fichehalfright">';
240 print '<div class="ficheaddleft">';
241 print '<div class="underbanner clearboth"></div>';
242 
243 print '<table class="border tableforfield" width="100%">';
244 
245 // Description
246 print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
247 print nl2br($object->description);
248 print '</td></tr>';
249 
250 // Categories
251 if ($conf->categorie->enabled) {
252  print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
253  print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
254  print "</td></tr>";
255 }
256 
257 print '</table>';
258 
259 print '</div>';
260 print '</div>';
261 print '</div>';
262 
263 print '<div class="clearboth"></div>';
264 
266 
267 print '<br>';
268 
269 /*
270  * Referers types
271  */
272 
273 $listofreferent = array(
274 'propal'=>array(
275  'name'=>"Proposals",
276  'title'=>"ListProposalsAssociatedProject",
277  'class'=>'Propal',
278  'table'=>'propal',
279  'datefieldname'=>'datep',
280  'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
281  'lang'=>'propal',
282  'buttonnew'=>'AddProp',
283  'testnew'=>$user->rights->propal->creer,
284  'test'=>$conf->propal->enabled && $user->rights->propale->lire),
285 'order'=>array(
286  'name'=>"CustomersOrders",
287  'title'=>"ListOrdersAssociatedProject",
288  'class'=>'Commande',
289  'table'=>'commande',
290  'datefieldname'=>'date_commande',
291  'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid,
292  'lang'=>'orders',
293  'buttonnew'=>'CreateOrder',
294  'testnew'=>$user->rights->commande->creer,
295  'test'=>$conf->commande->enabled && $user->rights->commande->lire),
296 'invoice'=>array(
297  'name'=>"CustomersInvoices",
298  'title'=>"ListInvoicesAssociatedProject",
299  'class'=>'Facture',
300  'margin'=>'add',
301  'table'=>'facture',
302  'datefieldname'=>'datef',
303  'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid,
304  'lang'=>'bills',
305  'buttonnew'=>'CreateBill',
306  'testnew'=>$user->rights->facture->creer,
307  'test'=>$conf->facture->enabled && $user->rights->facture->lire),
308 'invoice_predefined'=>array(
309  'name'=>"PredefinedInvoices",
310  'title'=>"ListPredefinedInvoicesAssociatedProject",
311  'class'=>'FactureRec',
312  'table'=>'facture_rec',
313  'datefieldname'=>'datec',
314  'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid,
315  'lang'=>'bills',
316  'buttonnew'=>'CreateBill',
317  'testnew'=>$user->rights->facture->creer,
318  'test'=>$conf->facture->enabled && $user->rights->facture->lire),
319 'proposal_supplier'=>array(
320  'name'=>"SuppliersProposals",
321  'title'=>"ListSupplierProposalsAssociatedProject",
322  'class'=>'SupplierProposal',
323  'table'=>'supplier_proposal',
324  'datefieldname'=>'date_valid',
325  'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
326  'lang'=>'supplier_proposal',
327  'buttonnew'=>'AddSupplierProposal',
328  'testnew'=>$user->rights->supplier_proposal->creer,
329  'test'=>$conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire),
330 'order_supplier'=>array(
331  'name'=>"SuppliersOrders",
332  'title'=>"ListSupplierOrdersAssociatedProject",
333  'class'=>'CommandeFournisseur',
334  'table'=>'commande_fournisseur',
335  'datefieldname'=>'date_commande',
336  'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
337  'lang'=>'suppliers',
338  'buttonnew'=>'AddSupplierOrder',
339  'testnew'=>$user->rights->fournisseur->commande->creer,
340  'test'=>$conf->supplier_order->enabled && $user->rights->fournisseur->commande->lire),
341 'invoice_supplier'=>array(
342  'name'=>"BillsSuppliers",
343  'title'=>"ListSupplierInvoicesAssociatedProject",
344  'class'=>'FactureFournisseur',
345  'margin'=>'minus',
346  'table'=>'facture_fourn',
347  'datefieldname'=>'datef',
348  'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
349  'lang'=>'suppliers',
350  'buttonnew'=>'AddSupplierInvoice',
351  'testnew'=>$user->rights->fournisseur->facture->creer,
352  'test'=>$conf->supplier_invoice->enabled && $user->rights->fournisseur->facture->lire),
353 'contract'=>array(
354  'name'=>"Contracts",
355  'title'=>"ListContractAssociatedProject",
356  'class'=>'Contrat',
357  'table'=>'contrat',
358  'datefieldname'=>'date_contrat',
359  'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid,
360  'lang'=>'contracts',
361  'buttonnew'=>'AddContract',
362  'testnew'=>$user->rights->contrat->creer,
363  'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
364 'intervention'=>array(
365  'name'=>"Interventions",
366  'title'=>"ListFichinterAssociatedProject",
367  'class'=>'Fichinter',
368  'table'=>'fichinter',
369  'datefieldname'=>'date_valid',
370  'disableamount'=>0,
371  'margin'=>'minus',
372  'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
373  'lang'=>'interventions',
374  'buttonnew'=>'AddIntervention',
375  'testnew'=>$user->rights->ficheinter->creer,
376  'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
377 'shipping'=>array(
378  'name'=>"Shippings",
379  'title'=>"ListShippingAssociatedProject",
380  'class'=>'Expedition',
381  'table'=>'expedition',
382  'datefieldname'=>'date_valid',
383  'urlnew'=>DOL_URL_ROOT.'/expedition/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
384  'lang'=>'sendings',
385  'buttonnew'=>'CreateShipment',
386  'testnew'=>0,
387  'test'=>$conf->expedition->enabled && $user->rights->expedition->lire),
388 'mrp'=>array(
389  'name'=>"MO",
390  'title'=>"ListMOAssociatedProject",
391  'class'=>'Mo',
392  'table'=>'mrp_mo',
393  'datefieldname'=>'date_valid',
394  'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
395  'lang'=>'mrp',
396  'buttonnew'=>'CreateMO',
397  'testnew'=>'$user->rights->mrp->write',
398  'project_field'=>'fk_project',
399  'test'=>$conf->mrp->enabled && $user->rights->mrp->read),
400 'trip'=>array(
401  'name'=>"TripsAndExpenses",
402  'title'=>"ListExpenseReportsAssociatedProject",
403  'class'=>'Deplacement',
404  'table'=>'deplacement',
405  'datefieldname'=>'dated',
406  'margin'=>'minus',
407  'disableamount'=>1,
408  'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid,
409  'lang'=>'trips',
410  'buttonnew'=>'AddTrip',
411  'testnew'=>$user->rights->deplacement->creer,
412  'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
413 'expensereport'=>array(
414  'name'=>"ExpenseReports",
415  'title'=>"ListExpenseReportsAssociatedProject",
416  'class'=>'ExpenseReportLine',
417  'table'=>'expensereport_det',
418  'datefieldname'=>'date',
419  'margin'=>'minus',
420  'disableamount'=>0,
421  'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid,
422  'lang'=>'trips',
423  'buttonnew'=>'AddTrip',
424  'testnew'=>$user->rights->expensereport->creer,
425  'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire),
426 'donation'=>array(
427  'name'=>"Donation",
428  'title'=>"ListDonationsAssociatedProject",
429  'class'=>'Don',
430  'margin'=>'add',
431  'table'=>'don',
432  'datefieldname'=>'datedon',
433  'disableamount'=>0,
434  'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid,
435  'lang'=>'donations',
436  'buttonnew'=>'AddDonation',
437  'testnew'=>$user->rights->don->creer,
438  'test'=>$conf->don->enabled && $user->rights->don->lire),
439 'loan'=>array(
440  'name'=>"Loan",
441  'title'=>"ListLoanAssociatedProject",
442  'class'=>'Loan',
443  'margin'=>'add',
444  'table'=>'loan',
445  'datefieldname'=>'datestart',
446  'disableamount'=>0,
447  'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid,
448  'lang'=>'loan',
449  'buttonnew'=>'AddLoan',
450  'testnew'=>$user->rights->loan->write,
451  'test'=>$conf->loan->enabled && $user->rights->loan->read),
452 'chargesociales'=>array(
453  'name'=>"SocialContribution",
454  'title'=>"ListSocialContributionAssociatedProject",
455  'class'=>'ChargeSociales',
456  'margin'=>'minus',
457  'table'=>'chargesociales',
458  'datefieldname'=>'date_ech',
459  'disableamount'=>0,
460  'urlnew'=>DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$id,
461  'lang'=>'compta',
462  'buttonnew'=>'AddSocialContribution',
463  'testnew'=>$user->rights->tax->charges->lire,
464  'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire),
465 'project_task'=>array(
466  'name'=>"TaskTimeSpent",
467  'title'=>"ListTaskTimeUserProject",
468  'class'=>'Task',
469  'margin'=>'minus',
470  'table'=>'projet_task',
471  'datefieldname'=>'task_date',
472  'disableamount'=>0,
473  'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id,
474  'buttonnew'=>'AddTimeSpent',
475  'testnew'=>$user->rights->projet->creer,
476  'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
477 'stock_mouvement'=>array(
478  'name'=>"MouvementStockAssociated",
479  'title'=>"ListMouvementStockProject",
480  'class'=>'MouvementStock',
481  'margin'=>'minus',
482  'table'=>'stock_mouvement',
483  'datefieldname'=>'datem',
484  'disableamount'=>0,
485  'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))),
486 'salaries'=>array(
487  'name'=>"Salaries",
488  'title'=>"ListSalariesAssociatedProject",
489  'class'=>'PaymentSalary',
490  'table'=>'payment_salary',
491  'datefieldname'=>'datev',
492  'margin'=>'minus',
493  'disableamount'=>0,
494  'urlnew'=>DOL_URL_ROOT.'/salaries/card.php?action=create&projectid='.$id,
495  'lang'=>'salaries',
496  'buttonnew'=>'AddSalaryPayment',
497  'testnew'=>$user->rights->salaries->write,
498  'test'=>$conf->salaries->enabled && $user->rights->salaries->read),
499 'variouspayment'=>array(
500  'name'=>"VariousPayments",
501  'title'=>"ListVariousPaymentsAssociatedProject",
502  'class'=>'PaymentVarious',
503  'table'=>'payment_various',
504  'datefieldname'=>'datev',
505  'margin'=>'minus',
506  'disableamount'=>0,
507  'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id,
508  'lang'=>'banks',
509  'buttonnew'=>'AddVariousPayment',
510  'testnew'=>$user->rights->banque->modifier,
511  'test'=>$conf->banque->enabled && $user->rights->banque->lire && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)),
512 /* No need for this, available on dedicated tab "Agenda/Events"
513 'agenda'=>array(
514  'name'=>"Agenda",
515  'title'=>"ListActionsAssociatedProject",
516  'class'=>'ActionComm',
517  'table'=>'actioncomm',
518  'datefieldname'=>'datep',
519  'disableamount'=>1,
520  'urlnew'=>DOL_URL_ROOT.'/comm/action/card.php?action=create&projectid='.$id.'&socid='.$socid,
521  'lang'=>'agenda',
522  'buttonnew'=>'AddEvent',
523  'testnew'=>$user->rights->agenda->myactions->create,
524  'test'=>$conf->agenda->enabled && $user->rights->agenda->myactions->read),
525 */
526 );
527 
528 // Change rules for profit/benefit calculation
529 if (!empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) {
530  foreach ($listofreferent as $key => $element) {
531  if ($listofreferent[$key]['margin'] == 'add') {
532  unset($listofreferent[$key]['margin']);
533  }
534  }
535  $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN);
536  foreach ($newelementforplusmargin as $value) {
537  $listofreferent[trim($value)]['margin'] = 'add';
538  }
539 }
540 if (!empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) {
541  foreach ($listofreferent as $key => $element) {
542  if ($listofreferent[$key]['margin'] == 'minus') {
543  unset($listofreferent[$key]['margin']);
544  }
545  }
546  $newelementforminusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN);
547  foreach ($newelementforminusmargin as $value) {
548  $listofreferent[trim($value)]['margin'] = 'minus';
549  }
550 }
551 
552 
553 
554 $parameters = array('listofreferent'=>$listofreferent);
555 $resHook = $hookmanager->executeHooks('completeListOfReferent', $parameters, $object, $action);
556 
557 if (!empty($hookmanager->resArray)) {
558  $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
559 }
560 
561 if ($action == "addelement")
562 {
563  $tablename = GETPOST("tablename");
564  $elementselectid = GETPOST("elementselect");
565  $result = $object->update_element($tablename, $elementselectid);
566  if ($result < 0)
567  {
568  setEventMessages($object->error, $object->errors, 'errors');
569  }
570 } elseif ($action == "unlink")
571 {
572  $tablename = GETPOST("tablename", "aZ09");
573  $projectField = GETPOSTISSET('projectfield') ? GETPOST('projectfield', 'aZ09') : 'fk_projet';
574  $elementselectid = GETPOST("elementselect", "int");
575 
576  $result = $object->remove_element($tablename, $elementselectid, $projectField);
577  if ($result < 0)
578  {
579  setEventMessages($object->error, $object->errors, 'errors');
580  }
581 }
582 
583 $elementuser = new User($db);
584 
585 
586 
587 $showdatefilter = 0;
588 // Show the filter on date on top of element list
589 if (!$showdatefilter)
590 {
591  print '<div class="center centpercent">';
592  print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
593  print '<input type="hidden" name="token" value="'.newToken().'">';
594  print '<input type="hidden" name="tablename" value="'.$tablename.'">';
595  print '<input type="hidden" name="action" value="view">';
596  print '<div class="inline-block">';
597  print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
598  print '</div>';
599  print '<div class="inline-block">';
600  print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
601  print '</div>';
602  print '<div class="inline-block">';
603  print '<input type="submit" name="refresh" value="'.$langs->trans("Refresh").'" class="button">';
604  print '</div>';
605  print '</form>';
606  print '</div>';
607 
608  $showdatefilter++;
609 }
610 
611 
612 
613 // Show balance for whole project
614 
615 $langs->loadLangs(array("suppliers", "bills", "orders", "proposals", "margins"));
616 
617 if (!empty($conf->stock->enabled)) $langs->load('stocks');
618 
619 print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy');
620 
621 print '<table class="noborder centpercent">';
622 print '<tr class="liste_titre">';
623 print '<td class="left" width="200">';
624 $tooltiponprofit = $langs->trans("ProfitIsCalculatedWith")."<br>\n";
625 $tooltiponprofitplus = $tooltiponprofitminus = '';
626 foreach ($listofreferent as $key => $value)
627 {
628  $name = $langs->trans($value['name']);
629  $qualified = $value['test'];
630  $margin = $value['margin'];
631  if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'add')
632  {
633  if ($margin == 'add') {
634  $tooltiponprofitplus .= ' &gt; '.$name." (+)<br>\n";
635  }
636  if ($margin == 'minus') {
637  $tooltiponprofitminus .= ' &gt; '.$name." (-)<br>\n";
638  }
639  }
640 }
641 $tooltiponprofit .= $tooltiponprofitplus;
642 $tooltiponprofit .= $tooltiponprofitminus;
643 print $form->textwithpicto($langs->trans("Element"), $tooltiponprofit);
644 print '</td>';
645 print '<td class="right" width="100">'.$langs->trans("Number").'</td>';
646 print '<td class="right" width="100">'.$langs->trans("AmountHT").'</td>';
647 print '<td class="right" width="100">'.$langs->trans("AmountTTC").'</td>';
648 print '</tr>';
649 
650 $total_revenue_ht = 0;
651 $balance_ht = 0;
652 $balance_ttc = 0;
653 
654 foreach ($listofreferent as $key => $value)
655 {
656  $parameters = array(
657  'total_revenue_ht' =>& $total_revenue_ht,
658  'balance_ht' =>& $balance_ht,
659  'balance_ttc' =>& $balance_ttc,
660  'key' => $key,
661  'value' =>& $value,
662  'dates' => $dates,
663  'datee' => $datee
664  );
665  $reshook = $hookmanager->executeHooks('printOverviewProfit', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
666  if ($reshook < 0) {
667  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
668  } elseif ($reshook > 0) {
669  print $hookmanager->resPrint;
670  continue;
671  }
672 
673  $name = $langs->trans($value['name']);
674  $title = $value['title'];
675  $classname = $value['class'];
676  $tablename = $value['table'];
677  $datefieldname = $value['datefieldname'];
678  $qualified = $value['test'];
679  $margin = $value['margin'];
680  $project_field = $value['project_field'];
681  if ($qualified && isset($margin)) { // If this element must be included into profit calculation ($margin is 'minus' or 'add')
682  $element = new $classname($db);
683 
684  $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet');
685 
686  if (is_array($elementarray) && count($elementarray) > 0) {
687  $total_ht = 0;
688  $total_ttc = 0;
689 
690  $num = count($elementarray);
691  for ($i = 0; $i < $num; $i++) {
692  $tmp = explode('_', $elementarray[$i]);
693  $idofelement = $tmp[0];
694  $idofelementuser = $tmp[1];
695 
696  $element->fetch($idofelement);
697  if ($idofelementuser) $elementuser->fetch($idofelementuser);
698 
699  // Define if record must be used for total or not
700  $qualifiedfortotal = true;
701  if ($key == 'invoice') {
702  if (!empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal = false; // Replacement invoice, do not include into total
703  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) $qualifiedfortotal = false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included
704  }
705  if ($key == 'propal') {
706  if ($element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedfortotal = false; // Only signed proposal must not be included in total
707  }
708 
709  if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
710 
711  // Define $total_ht_by_line
712  if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line = $element->amount;
713  elseif ($tablename == 'fichinter') $total_ht_by_line = $element->getAmount();
714  elseif ($tablename == 'stock_mouvement') $total_ht_by_line = $element->price * abs($element->qty);
715  elseif ($tablename == 'projet_task') {
716  if ($idofelementuser) {
717  $tmp = $element->getSumOfAmount($elementuser, $dates, $datee);
718  $total_ht_by_line = price2num($tmp['amount'], 'MT');
719  } else {
720  $tmp = $element->getSumOfAmount('', $dates, $datee);
721  $total_ht_by_line = price2num($tmp['amount'], 'MT');
722  }
723  } elseif ($key == 'loan') {
724  if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
725  // Get total loan
726  $total_ht_by_line = -$element->capital;
727  } else {
728  // Get loan schedule according to date filter
729  $total_ht_by_line = 0;
730  $loanScheduleStatic = new LoanSchedule($element->db);
731  $loanScheduleStatic->fetchAll($element->id);
732  if (!empty($loanScheduleStatic->lines)) {
733  foreach ($loanScheduleStatic->lines as $loanSchedule) {
737  if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee) // dates filter is defined
738  || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <= dol_now()
739  || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
740  ) {
741  $total_ht_by_line -= $loanSchedule->amount_capital;
742  }
743  }
744  }
745  }
746  } else $total_ht_by_line = $element->total_ht;
747 
748  // Define $total_ttc_by_line
749  if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ttc_by_line = $element->amount;
750  elseif ($tablename == 'fichinter') $total_ttc_by_line = $element->getAmount();
751  elseif ($tablename == 'stock_mouvement') $total_ttc_by_line = $element->price * abs($element->qty);
752  elseif ($tablename == 'projet_task') {
753  $defaultvat = get_default_tva($mysoc, $mysoc);
754  $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT');
755  } elseif ($key == 'loan') {
756  $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr
757  } else $total_ttc_by_line = $element->total_ttc;
758 
759  // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases
760  if ($tablename == 'payment_various') {
761  if ($element->sens == 1) {
762  $total_ht_by_line = -$total_ht_by_line;
763  $total_ttc_by_line = -$total_ttc_by_line;
764  }
765  }
766 
767  // Add total if we have to
768  if ($qualifiedfortotal) {
769  $total_ht = $total_ht + $total_ht_by_line;
770  $total_ttc = $total_ttc + $total_ttc_by_line;
771  }
772  }
773 
774  // Each element with at least one line is output
775  $qualifiedforfinalprofit = true;
776  if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit = false;
777  //var_dump($key.' '.$qualifiedforfinalprofit);
778 
779  // Calculate margin
780  if ($qualifiedforfinalprofit) {
781  if ($margin == 'add') {
782  $total_revenue_ht += $total_ht;
783  }
784 
785  if ($margin != "add") { // Revert sign
786  $total_ht = -$total_ht;
787  $total_ttc = -$total_ttc;
788  }
789 
790  $balance_ht += $total_ht;
791  $balance_ttc += $total_ttc;
792  }
793 
794  print '<tr class="oddeven">';
795  // Module
796  print '<td class="left">'.$name.'</td>';
797  // Nb
798  print '<td class="right">'.$i.'</td>';
799  // Amount HT
800  print '<td class="right">';
801  if ($key == 'intervention' && !$qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
802  else {
803  print price($total_ht);
804  if ($key == 'propal') print '<span class="opacitymedium">'.$form->textwithpicto('', $langs->trans("SignedOnly")).'</span>';
805  }
806  print '</td>';
807  // Amount TTC
808  print '<td class="right">';
809  if ($key == 'intervention' && !$qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
810  else {
811  print price($total_ttc);
812  if ($key == 'propal') print '<span class="opacitymedium">'.$form->textwithpicto('', $langs->trans("SignedOnly")).'</span>';
813  }
814  print '</td>';
815  print '</tr>';
816  }
817  }
818 }
819 // and the final balance
820 print '<tr class="liste_total">';
821 print '<td class="right" colspan="2">'.$langs->trans("Profit").'</td>';
822 print '<td class="right">'.price(price2num($balance_ht, 'MT')).'</td>';
823 print '<td class="right">'.price(price2num($balance_ttc, 'MT')).'</td>';
824 print '</tr>';
825 
826 // and the margin (profit / revenues)
827 if ($total_revenue_ht) {
828  print '<tr class="liste_total">';
829  print '<td class="right" colspan="2">'.$langs->trans("Margin").'</td>';
830  print '<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).'%</td>';
831  print '<td class="right"></td>';
832  print '</tr>';
833 }
834 
835 print "</table>";
836 
837 
838 print '<br><br>';
839 print '<br>';
840 
841 
842 
843 // Detail
844 foreach ($listofreferent as $key => $value)
845 {
846  $parameters = array(
847  'key' => $key,
848  'value' =>& $value,
849  'dates' => $dates,
850  'datee' => $datee
851  );
852  $reshook = $hookmanager->executeHooks('printOverviewDetail', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
853  if ($reshook < 0) {
854  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
855  } elseif ($reshook > 0) {
856  print $hookmanager->resPrint;
857  continue;
858  }
859 
860  $title = $value['title'];
861  $classname = $value['class'];
862  $tablename = $value['table'];
863  $datefieldname = $value['datefieldname'];
864  $qualified = $value['test'];
865  $langtoload = $value['lang'];
866  $urlnew = $value['urlnew'];
867  $buttonnew = $value['buttonnew'];
868  $testnew = $value['testnew'];
869  $project_field = $value['project_field'];
870 
871  $exclude_select_element = array('payment_various');
872  if (!empty($value['exclude_select_element'])) $exclude_select_element[] = $value['exclude_select_element'];
873 
874  if ($qualified) {
875  // If we want the project task array to have details of users
876  //if ($key == 'project_task') $key = 'project_task_time';
877 
878  if ($langtoload) $langs->load($langtoload);
879 
880  $element = new $classname($db);
881 
882  $addform = '';
883 
884  $idtofilterthirdparty = 0;
885  $array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur');
886  if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
887  {
888  $idtofilterthirdparty = $object->thirdparty->id;
889  if (!empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty .= ','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
890  }
891 
892  if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element))
893  {
894  $selectList = $formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300 minwidth75imp', -2, !empty($project_field) ? $project_field : 'fk_projet');
895  if ($selectList < 0)
896  {
897  setEventMessages($formproject->error, $formproject->errors, 'errors');
898  } elseif ($selectList)
899  {
900  // Define form with the combo list of elements to link
901  $addform .= '<div class="inline-block valignmiddle">';
902  $addform .= '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
903  $addform .= '<input type="hidden" name="token" value="'.newToken().'">';
904  $addform .= '<input type="hidden" name="tablename" value="'.$tablename.'">';
905  $addform .= '<input type="hidden" name="action" value="addelement">';
906  $addform .= '<input type="hidden" name="datesrfc" value="'.dol_print_date($dates, 'dayhourrfc').'">';
907  $addform .= '<input type="hidden" name="dateerfc" value="'.dol_print_date($datee, 'dayhourrfc').'">';
908  $addform .= '<table><tr><td><span class="hideonsmartphone opacitymedium">'.$langs->trans("SelectElement").'</span></td>';
909  $addform .= '<td>'.$selectList.'</td>';
910  $addform .= '<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("LinkToElementShort")).'"></td>';
911  $addform .= '</tr></table>';
912  $addform .= '</form>';
913  $addform .= '</div>';
914  }
915  }
916  if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew)
917  {
918  $addform .= '<div class="inline-block valignmiddle">';
919  if ($testnew) $addform .= '<a class="buttonxxx" href="'.$urlnew.'"><span class="valignmiddle text-plus-circle hideonsmartphone">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
920  elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
921  $addform .= '<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle hideonsmartphone">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
922  }
923  $addform .= '<div>';
924  }
925 
926  print load_fiche_titre($langs->trans($title), $addform, '');
927 
928  print "\n".'<!-- Table for tablename = '.$tablename.' -->'."\n";
929  print '<div class="div-table-responsive">';
930  print '<table class="noborder centpercent">';
931 
932  print '<tr class="liste_titre">';
933  // Remove link column
934  print '<td style="width: 24px"></td>';
935  // Ref
936  print '<td'.(($tablename != 'actioncomm' && $tablename != 'projet_task') ? ' style="width: 200px"' : '').'>'.$langs->trans("Ref").'</td>';
937  // Date
938  print '<td'.(($tablename != 'actioncomm' && $tablename != 'projet_task') ? ' style="width: 200px"' : '').' class="center">';
939  if (in_array($tablename, array('projet_task'))) print $langs->trans("TimeSpent");
940  if (!in_array($tablename, array('projet_task'))) print $langs->trans("Date");
941  print '</td>';
942  // Thirdparty or user
943  print '<td>';
944  if (in_array($tablename, array('projet_task')) && $key == 'project_task') print ''; // if $key == 'project_task', we don't want details per user
945  elseif (in_array($tablename, array('payment_various'))) print ''; // if $key == 'payment_various', we don't have any thirdparty
946  elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'payment_salary'))) print $langs->trans("User");
947  else print $langs->trans("ThirdParty");
948  print '</td>';
949  // Duration of intervention
950  if ($tablename == 'fichinter')
951  {
952  print '<td>';
953  print $langs->trans("TotalDuration");
954  $total_duration = 0;
955  print '</td>';
956  }
957  // Amount HT
958  //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="120">'.$langs->trans("AmountHT").'</td>';
959  //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="120">'.$langs->trans("Amount").'</td>';
960  if ($key == 'loan') print '<td class="right" width="120">'.$langs->trans("LoanCapital").'</td>';
961  elseif (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountHT").'</td>';
962  else print '<td width="120"></td>';
963  // Amount TTC
964  //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="120">'.$langs->trans("AmountTTC").'</td>';
965  if ($key == 'loan') print '<td class="right" width="120">'.$langs->trans("RemainderToPay").'</td>';
966  elseif (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountTTC").'</td>';
967  else print '<td width="120"></td>';
968  // Status
969  if (in_array($tablename, array('projet_task'))) print '<td class="right" width="200">'.$langs->trans("ProgressDeclared").'</td>';
970  else print '<td class="right" width="200">'.$langs->trans("Status").'</td>';
971  print '</tr>';
972 
973  $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet');
974  if (is_array($elementarray) && count($elementarray) > 0)
975  {
976  $total_ht = 0;
977  $total_ttc = 0;
978 
979  $total_ht_by_third = 0;
980  $total_ttc_by_third = 0;
981 
982  $saved_third_id = 0;
983  $breakline = '';
984 
985  if (canApplySubtotalOn($tablename))
986  {
987  // Sort
988  $elementarray = sortElementsByClientName($elementarray);
989  }
990 
991  $num = count($elementarray);
992  for ($i = 0; $i < $num; $i++)
993  {
994  $tmp = explode('_', $elementarray[$i]);
995  $idofelement = $tmp[0];
996  $idofelementuser = $tmp[1];
997 
998  $element->fetch($idofelement);
999  if ($idofelementuser) $elementuser->fetch($idofelementuser);
1000 
1001  // Special cases
1002  if ($tablename != 'expensereport_det')
1003  {
1004  if (method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
1005  } else {
1006  $expensereport = new ExpenseReport($db);
1007  $expensereport->fetch($element->fk_expensereport);
1008  }
1009 
1010  //print 'xxx'.$tablename.'yyy'.$classname;
1011 
1012  if ($breakline && $saved_third_id != $element->thirdparty->id)
1013  {
1014  print $breakline;
1015 
1016  $saved_third_id = $element->thirdparty->id;
1017  $breakline = '';
1018 
1019  $total_ht_by_third = 0;
1020  $total_ttc_by_third = 0;
1021  }
1022  $saved_third_id = $element->thirdparty->id;
1023 
1024  $qualifiedfortotal = true;
1025  if ($key == 'invoice')
1026  {
1027  if (!empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal = false; // Replacement invoice, do not include into total
1028  }
1029 
1030  print '<tr class="oddeven">';
1031 
1032  // Remove link
1033  print '<td style="width: 24px">';
1034  if ($tablename != 'projet_task' && $tablename != 'stock_mouvement')
1035  {
1036  if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true
1037  {
1038  print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=unlink&tablename='.$tablename.'&elementselect='.$element->id.($project_field ? '&projectfield='.$project_field : '').'" class="reposition">';
1039  print img_picto($langs->trans('Unlink'), 'unlink');
1040  print '</a>';
1041  }
1042  }
1043  print "</td>\n";
1044 
1045  // Ref
1046  print '<td class="left nowraponall">';
1047  if ($tablename == 'expensereport_det')
1048  {
1049  print $expensereport->getNomUrl(1);
1050  } else {
1051  // Show ref with link
1052  if ($element instanceof Task)
1053  {
1054  print $element->getNomUrl(1, 'withproject', 'time');
1055  print ' - '.dol_trunc($element->label, 48);
1056  } elseif ($key == 'loan') {
1057  print $element->getNomUrl(1);
1058  print ' - '.dol_trunc($element->label, 48);
1059  } else print $element->getNomUrl(1);
1060 
1061  $element_doc = $element->element;
1062  $filename = dol_sanitizeFileName($element->ref);
1063  $filedir = $conf->{$element_doc}->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref);
1064 
1065  if ($element_doc === 'order_supplier') {
1066  $element_doc = 'commande_fournisseur';
1067  $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref);
1068  } elseif ($element_doc === 'invoice_supplier') {
1069  $element_doc = 'facture_fournisseur';
1070  $filename = get_exdir($element->id, 2, 0, 0, $element, 'product').dol_sanitizeFileName($element->ref);
1071  $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].'/'.get_exdir($element->id, 2, 0, 0, $element, 'invoice_supplier').dol_sanitizeFileName($element->ref);
1072  }
1073 
1074  print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>';
1075 
1076  // Show supplier ref
1077  if (!empty($element->ref_supplier)) print ' - '.$element->ref_supplier;
1078  // Show customer ref
1079  if (!empty($element->ref_customer)) print ' - '.$element->ref_customer;
1080  }
1081  print "</td>\n";
1082 
1083  // Date or TimeSpent
1084  $date = ''; $total_time_by_line = null;
1085  if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
1086  elseif ($tablename == 'stock_mouvement') $date = $element->datem;
1087  elseif ($tablename == 'payment_salary') $date = $element->datev;
1088  elseif ($tablename == 'payment_various') $date = $element->datev;
1089  elseif ($tablename == 'chargesociales') $date = $element->date_ech;
1090  elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status))
1091  {
1092  if ($tablename == 'don') $date = $element->datedon;
1093  if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
1094  {
1095  $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1096  } elseif ($tablename == 'supplier_proposal') $date = $element->date_validation; // There is no other date for this
1097  elseif ($tablename == 'fichinter') $date = $element->datev; // There is no other date for this
1098  elseif ($tablename == 'projet_task') $date = ''; // We show no date. Showing date of beginning of task make user think it is date of time consumed
1099  else {
1100  $date = $element->date; // invoice, ...
1101  if (empty($date)) $date = $element->date_contrat;
1102  if (empty($date)) $date = $element->datev;
1103  if (empty($date) && !empty($datefieldname)) {
1104  $date = $element->$datefieldname;
1105  }
1106  }
1107  } elseif ($key == 'loan') {
1108  $date = $element->datestart;
1109  }
1110 
1111  print '<td class="center">';
1112  if ($tablename == 'actioncomm')
1113  {
1114  print dol_print_date($element->datep, 'dayhour');
1115  if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef, 'dayhour');
1116  } elseif (in_array($tablename, array('projet_task')))
1117  {
1118  $tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
1119  print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$idofelement.'&withproject=1">';
1120  print convertSecondToTime($tmpprojtime['nbseconds'], 'allhourmin');
1121  print '</a>';
1122  $total_time_by_line = $tmpprojtime['nbseconds'];
1123  } else print dol_print_date($date, 'day');
1124  print '</td>';
1125 
1126  // Third party or user
1127  print '<td class="left">';
1128  if (is_object($element->thirdparty)) {
1129  print $element->thirdparty->getNomUrl(1, '', 48);
1130  } elseif ($tablename == 'expensereport_det') {
1131  $tmpuser = new User($db);
1132  $tmpuser->fetch($expensereport->fk_user_author);
1133  print $tmpuser->getNomUrl(1, '', 48);
1134  } elseif ($tablename == 'payment_salary')
1135  {
1136  $tmpuser = new User($db);
1137  $tmpuser->fetch($element->fk_user);
1138  print $tmpuser->getNomUrl(1, '', 48);
1139  } elseif ($tablename == 'don' || $tablename == 'stock_mouvement')
1140  {
1141  if ($element->fk_user_author > 0)
1142  {
1143  $tmpuser2 = new User($db);
1144  $tmpuser2->fetch($element->fk_user_author);
1145  print $tmpuser2->getNomUrl(1, '', 48);
1146  }
1147  } elseif ($tablename == 'projet_task' && $key == 'project_task_time') // if $key == 'project_task', we don't want details per user
1148  {
1149  print $elementuser->getNomUrl(1);
1150  }
1151  print '</td>';
1152 
1153  // Add duration and store it in counter for fichinter
1154  if ($tablename == 'fichinter')
1155  {
1156  print '<td>';
1157  print convertSecondToTime($element->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
1158  $total_duration += $element->duration;
1159  print '</td>';
1160  }
1161 
1162  // Amount without tax
1163  $warning = '';
1164  if (empty($value['disableamount']))
1165  {
1166  $total_ht_by_line = null;
1167  $othermessage = '';
1168  if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line = $element->amount;
1169  elseif ($tablename == 'fichinter') $total_ht_by_line = $element->getAmount();
1170  elseif ($tablename == 'stock_mouvement') $total_ht_by_line = $element->price * abs($element->qty);
1171  elseif (in_array($tablename, array('projet_task')))
1172  {
1173  if (!empty($conf->salaries->enabled))
1174  {
1175  // TODO Permission to read daily rate to show value
1176  $total_ht_by_line = price2num($tmpprojtime['amount'], 'MT');
1177  if ($tmpprojtime['nblinesnull'] > 0)
1178  {
1179  $langs->load("errors");
1180  $warning = $langs->trans("WarningSomeLinesWithNullHourlyRate", $conf->currency);
1181  }
1182  } else {
1183  $othermessage = $form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1184  }
1185  } elseif ($key == 'loan') $total_ht_by_line = $element->capital;
1186  else {
1187  $total_ht_by_line = $element->total_ht;
1188  }
1189 
1190  // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases
1191  if ($tablename == 'payment_various')
1192  {
1193  if ($element->sens == 0)
1194  {
1195  $total_ht_by_line = -$total_ht_by_line;
1196  }
1197  }
1198 
1199  print '<td class="right">';
1200  if ($othermessage) print $othermessage;
1201  if (isset($total_ht_by_line))
1202  {
1203  if (!$qualifiedfortotal) print '<strike>';
1204  print price($total_ht_by_line);
1205  if (!$qualifiedfortotal) print '</strike>';
1206  }
1207  if ($warning) print ' '.img_warning($warning);
1208  print '</td>';
1209  } else print '<td></td>';
1210 
1211  // Amount inc tax
1212  if (empty($value['disableamount']))
1213  {
1214  $total_ttc_by_line = null;
1215  if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ttc_by_line = $element->amount;
1216  elseif ($tablename == 'fichinter') $total_ttc_by_line = $element->getAmount();
1217  elseif ($tablename == 'stock_mouvement') $total_ttc_by_line = $element->price * abs($element->qty);
1218  elseif ($tablename == 'projet_task')
1219  {
1220  if (!empty($conf->salaries->enabled))
1221  {
1222  // TODO Permission to read daily rate
1223  $defaultvat = get_default_tva($mysoc, $mysoc);
1224  $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT');
1225  } else {
1226  $othermessage = $form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1227  }
1228  } elseif ($key == 'loan') $total_ttc_by_line = $element->capital - $element->getSumPayment();
1229  else {
1230  $total_ttc_by_line = $element->total_ttc;
1231  }
1232 
1233  // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases
1234  if ($tablename == 'payment_various')
1235  {
1236  if ($element->sens == 0)
1237  {
1238  $total_ttc_by_line = -$total_ttc_by_line;
1239  }
1240  }
1241 
1242  print '<td class="right">';
1243  if ($othermessage) print $othermessage;
1244  if (isset($total_ttc_by_line))
1245  {
1246  if (!$qualifiedfortotal) print '<strike>';
1247  print price($total_ttc_by_line);
1248  if (!$qualifiedfortotal) print '</strike>';
1249  }
1250  if ($warning) print ' '.img_warning($warning);
1251  print '</td>';
1252  } else print '<td></td>';
1253 
1254  // Status
1255  print '<td class="right">';
1256  if ($tablename == 'expensereport_det')
1257  {
1258  print $expensereport->getLibStatut(5);
1259  } elseif ($element instanceof CommonInvoice)
1260  {
1261  //This applies for Facture and FactureFournisseur
1262  print $element->getLibStatut(5, $element->getSommePaiement());
1263  } elseif ($element instanceof Task)
1264  {
1265  if ($element->progress != '')
1266  {
1267  print $element->progress.' %';
1268  }
1269  } elseif ($tablename == 'stock_mouvement')
1270  {
1271  print $element->getLibStatut(3);
1272  } else {
1273  print $element->getLibStatut(5);
1274  }
1275  print '</td>';
1276 
1277  print '</tr>';
1278 
1279  if ($qualifiedfortotal)
1280  {
1281  $total_ht = $total_ht + $total_ht_by_line;
1282  $total_ttc = $total_ttc + $total_ttc_by_line;
1283 
1284  $total_ht_by_third += $total_ht_by_line;
1285  $total_ttc_by_third += $total_ttc_by_line;
1286 
1287  $total_time = $total_time + $total_time_by_line;
1288  }
1289 
1290  if (canApplySubtotalOn($tablename))
1291  {
1292  $breakline = '<tr class="liste_total liste_sub_total">';
1293  $breakline .= '<td colspan="2">';
1294  $breakline .= '</td>';
1295  $breakline .= '<td>';
1296  $breakline .= '</td>';
1297  $breakline .= '<td class="right">';
1298  $breakline .= $langs->trans('SubTotal').' : ';
1299  if (is_object($element->thirdparty)) $breakline .= $element->thirdparty->getNomUrl(0, '', 48);
1300  $breakline .= '</td>';
1301  $breakline .= '<td class="right">'.price($total_ht_by_third).'</td>';
1302  $breakline .= '<td class="right">'.price($total_ttc_by_third).'</td>';
1303  $breakline .= '<td></td>';
1304  $breakline .= '</tr>';
1305  }
1306 
1307  //var_dump($element->thirdparty->name.' - '.$saved_third_id.' - '.$element->thirdparty->id);
1308  }
1309 
1310  if ($breakline) print $breakline;
1311 
1312  // Total
1313  $colspan = 4;
1314  if (in_array($tablename, array('projet_task'))) $colspan = 2;
1315  print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Number").': '.$i.'</td>';
1316  if (in_array($tablename, array('projet_task')))
1317  {
1318  print '<td class="center">';
1319  print convertSecondToTime($total_time, 'allhourmin');
1320  print '</td>';
1321  print '<td>';
1322  print '</td>';
1323  }
1324  //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
1325  //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
1326  // If fichinter add the total_duration
1327  if ($tablename == 'fichinter') print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
1328  print '<td class="right">';
1329  if (empty($value['disableamount']))
1330  {
1331  if ($key == 'loan') print $langs->trans("Total").' '.$langs->trans("LoanCapital").' : '.price($total_ttc);
1332  elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
1333  }
1334  print '</td>';
1335  //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
1336  //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100"></td>';
1337  print '<td class="right">';
1338  if (empty($value['disableamount']))
1339  {
1340  if ($key == 'loan') print $langs->trans("Total").' '.$langs->trans("RemainderToPay").' : '.price($total_ttc);
1341  elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
1342  }
1343  print '</td>';
1344  print '<td>&nbsp;</td>';
1345  print '</tr>';
1346  } else {
1347  if (!is_array($elementarray)) // error
1348  {
1349  print $elementarray;
1350  }
1351  }
1352  print "</table>";
1353  print '</div>';
1354  print "<br>\n";
1355  }
1356 }
1357 
1358 // Enhance with select2
1359 if ($conf->use_javascript_ajax)
1360 {
1361  include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1362  $comboenhancement = ajax_combobox('.elementselect');
1363 
1364  print $comboenhancement;
1365 }
1366 
1367 // End of page
1368 llxFooter();
1369 $db->close();
1370 
1371 
1372 
1379 function canApplySubtotalOn($tablename)
1380 {
1381  global $conf;
1382 
1383  if (empty($conf->global->PROJECT_ADD_SUBTOTAL_LINES)) return false;
1384  return in_array($tablename, array('facture_fourn', 'commande_fournisseur'));
1385 }
1386 
1393 function sortElementsByClientName($elementarray)
1394 {
1395  global $db, $classname;
1396 
1397  $element = new $classname($db);
1398 
1399  $clientname = array();
1400  foreach ($elementarray as $key => $id) // id = id of object
1401  {
1402  if (empty($clientname[$id]))
1403  {
1404  $element->fetch($id);
1405  $element->fetch_thirdparty();
1406 
1407  $clientname[$id] = $element->thirdparty->name;
1408  }
1409  }
1410 
1411  //var_dump($clientname);
1412  asort($clientname); // sort on name
1413 
1414  $elementarray = array();
1415  foreach ($clientname as $id => $name)
1416  {
1417  $elementarray[] = $id;
1418  }
1419 
1420  return $elementarray;
1421 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
if(!empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort"u if(!empty($arrayfields['u.tms']['checked'])) print_liste_field_titre("DateModificationShort"u if(!empty($arrayfields['u.statut']['checked'])) print_liste_field_titre("Status"u statut
Definition: list.php:632
sortElementsByClientName($elementarray)
sortElementsByClientName
Definition: element.php:1393
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
Definition: user.class.php:44
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:391
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:481
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...
Definition: date.lib.php:319
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage Schedule of loans.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
const STATUS_BILLED
Billed or processed quote.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
Class to manage building of HTML components.
const STATUS_SIGNED
Signed quote.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
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.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
Definition: notice.php:44
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
Class to manage Trips and Expenses.
Class to offer components to list and upload files.
Superclass for invoices classes.
const TYPE_DEPOSIT
Deposit invoice.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
Definition: project.lib.php:36
print
Draft customers invoices.
Definition: index.php:89
Class to manage tasks.
Definition: task.class.php:35
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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) Si ...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
canApplySubtotalOn($tablename)
Return if we should do a group by customer with sub-total.
Definition: element.php:1379
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
Definition: date.lib.php:180