38require
'../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/timespent.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
60 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
66 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
69 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
72 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
75 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
78 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
81 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
82 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
85 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
88 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
89 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
92 require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
95 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
98 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
101 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
102 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
105 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
108 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
111 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
114 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
117 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
118 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransferline.class.php';
122$langs->loadLangs(array(
'projects',
'companies',
'suppliers',
'compta'));
124 $langs->load(
"bills");
127 $langs->load(
"orders");
130 $langs->load(
"propal");
133 $langs->load(
"interventions");
136 $langs->load(
"trips");
139 $langs->load(
"trips");
142 $langs->load(
"donations");
145 $langs->load(
"loan");
148 $langs->load(
"salaries");
154 $langs->load(
"eventorganization");
159$action =
GETPOST(
'action',
'aZ09');
160$datesrfc =
GETPOST(
'datesrfc');
161$dateerfc =
GETPOST(
'dateerfc');
164if (empty($dates) && !empty($datesrfc)) {
167if (empty($datee) && !empty($dateerfc)) {
170if (!GETPOSTISSET(
'datesrfc') && !GETPOSTISSET(
'datesday') &&
getDolGlobalString(
'PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) {
177if ($id ==
'' && $ref ==
'') {
179 header(
'Location: list.php');
183$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
187include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
188if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
195$hookmanager->initHooks(array(
'projectOverview'));
202 (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire'))
203 || (
isModEnabled(
'supplier_invoice') && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')))
204 || (
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read'))
205 || (
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire'))
206 || (
isModEnabled(
'don') && $user->hasRight(
'don',
'lire'))
207 || (
isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire'))
208 || (
isModEnabled(
'bank') && $user->hasRight(
'banque',
'lire'))
212$total_ttc_by_line = 0;
213$total_ht_by_line = 0;
214$expensereport =
null;
216$tmpprojtime = array();
219$permissiontoadd = $user->hasRight(
'projet',
'creer');
220$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
221$permissiondellink = $user->hasRight(
'projet',
'creer');
222$permissiontoeditextra = $permissiontoadd;
223if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
225 $permissiontoeditextra =
dol_eval($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
233if ($action ==
'update_extras' && $permissiontoeditextra) {
237 $attribute_name =
GETPOST(
'attribute',
'aZ09');
240 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
246 $result =
$object->updateExtraField($attribute_name,
'PROJECT_MODIFY');
254 $action =
'edit_extras';
257if (($action ==
'updateundefinedwithlasthourlyrate' || $action ==
'updateallwithlasthourlyrate') && $permissiontoadd) {
259 if (!GETPOSTISSET(
'taskid')) {
265 $sql =
"SELECT et.rowid as id, u.thm as thmuser";
266 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as et";
267 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = et.fk_user";
268 $sql .=
" WHERE et.elementtype = 'task'";
269 $sql .=
" AND et.fk_element = ".((int) $taskid);
270 if ($action ==
'updateundefinedwithlasthourlyrate') {
271 $sql .=
" AND et.thm IS NULL";
274 $resql =
$db->query($sql);
276 $num =
$db->num_rows($resql);
279 $obj =
$db->fetch_object($resql);
280 if (empty($obj->thmuser)) {
285 $res = $timespent->fetch($obj->id);
291 $timespent->thm = $obj->thmuser;
292 $res = $timespent->update($user);
319$title = $langs->trans(
'ProjectReferers').
' - '.
$object->ref.
' '.
$object->name;
321 $title =
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
'ProjectReferers');
324$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
326llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project page-card_element');
335$userAccess =
$object->restrictedProjectArea($user);
343if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
344 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
345 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
346 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
348 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
351$morehtmlref =
'<div class="refidno">';
355if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
356 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
358$morehtmlref .=
'</div>';
361if (!$user->hasRight(
'projet',
'all',
'lire')) {
362 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
363 $object->next_prev_filter =
"te.rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
366dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
369print
'<div class="fichecenter">';
370print
'<div class="fichehalfleft">';
371print
'<div class="underbanner clearboth"></div>';
373print
'<table class="border tableforfield centpercent">';
377 print
'<tr><td class="tdtop">';
378 print $langs->trans(
"Usage");
382 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
383 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
384 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
388 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
389 $htmltext = $langs->trans(
"ProjectFollowTasks");
390 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
394 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"' :
'')).
'"> ';
395 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
396 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
400 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"' :
'')).
'"> ';
401 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
402 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
409 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
412 print $langs->trans(
"OppStatus".$code);
416 print
' <span title="'.$langs->trans(
"OpportunityProbability").
'"> / ';
417 if (strcmp(
$object->opp_percent,
'')) {
418 print
price(
$object->opp_percent, 0, $langs, 1, 0).
' %';
420 print
'</span></td></tr>';
423 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
424 if (!is_null(
$object->opp_amount) && strcmp(
$object->opp_amount,
'')) {
425 print
'<span class="amount">'.price(
$object->opp_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
426 if (strcmp(
$object->opp_percent,
'')) {
427 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>';
434print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
435if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
436 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
441print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
443print($start ? $start :
'?');
446print($end ? $end :
'?');
453print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
455 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
456 print $langs->trans(
'SharedProject');
458 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
459 print $langs->trans(
'PrivateProject');
465include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
470print
'<div class="fichehalfright">';
471print
'<div class="underbanner clearboth"></div>';
473print
'<table class="border tableforfield centpercent">';
477 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
478 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
483print
'<tr><td class="titlefield'.($object->description ?
' noborderbottom' :
'').
'" colspan="2">'.$langs->trans(
"Description").
'</td></tr>';
485 print
'<tr><td class="nottitleforfield" colspan="2">';
486 print
'<div class="longmessagecut">';
497print
'<div class="clearboth"></div>';
507$listofreferent = array(
509 'name' =>
"Warehouse",
510 'title' =>
"ListWarehouseAssociatedProject",
511 'class' =>
'Entrepot',
512 'table' =>
'entrepot',
513 'datefieldname' =>
'date_entrepot',
514 'urlnew' => DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
515 'lang' =>
'entrepot',
516 'buttonnew' =>
'AddWarehouse',
517 'project_field' =>
'fk_project',
518 'testnew' => $user->hasRight(
'stock',
'creer'),
522 'name' =>
"Proposals",
523 'title' =>
"ListProposalsAssociatedProject",
526 'datefieldname' =>
'datep',
527 'urlnew' => DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
529 'buttonnew' =>
'AddProp',
530 'testnew' => $user->hasRight(
'propal',
'creer'),
531 'test' =>
isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')
534 'name' =>
"CustomersOrders",
535 'title' =>
"ListOrdersAssociatedProject",
536 'class' =>
'Commande',
537 'table' =>
'commande',
538 'datefieldname' =>
'date_commande',
539 'urlnew' => DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
541 'buttonnew' =>
'CreateOrder',
542 'testnew' => $user->hasRight(
'commande',
'creer'),
543 'test' =>
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')
546 'name' =>
"CustomersInvoices",
547 'title' =>
"ListInvoicesAssociatedProject",
548 'class' =>
'Facture',
550 'table' =>
'facture',
551 'datefieldname' =>
'datef',
552 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
554 'buttonnew' =>
'CreateBill',
555 'testnew' => $user->hasRight(
'facture',
'creer'),
556 'test' =>
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
558 'invoice_predefined' => array(
559 'name' =>
"PredefinedInvoices",
560 'title' =>
"ListPredefinedInvoicesAssociatedProject",
561 'class' =>
'FactureRec',
562 'table' =>
'facture_rec',
563 'datefieldname' =>
'datec',
564 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
566 'buttonnew' =>
'CreateBill',
567 'testnew' => $user->hasRight(
'facture',
'creer'),
568 'test' =>
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
570 'proposal_supplier' => array(
571 'name' =>
"SupplierProposals",
572 'title' =>
"ListSupplierProposalsAssociatedProject",
573 'class' =>
'SupplierProposal',
574 'table' =>
'supplier_proposal',
575 'datefieldname' =>
'date_valid',
576 'urlnew' => DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
577 'lang' =>
'supplier_proposal',
578 'buttonnew' =>
'AddSupplierProposal',
579 'testnew' => $user->hasRight(
'supplier_proposal',
'creer'),
580 'test' =>
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')
582 'order_supplier' => array(
583 'name' =>
"SuppliersOrders",
584 'title' =>
"ListSupplierOrdersAssociatedProject",
585 'class' =>
'CommandeFournisseur',
586 'table' =>
'commande_fournisseur',
587 'datefieldname' =>
'date_commande',
588 'urlnew' => DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
589 'lang' =>
'suppliers',
590 'buttonnew' =>
'AddSupplierOrder',
591 'testnew' => $user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'),
592 'test' =>
isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'lire')
594 'invoice_supplier' => array(
595 'name' =>
"BillsSuppliers",
596 'title' =>
"ListSupplierInvoicesAssociatedProject",
597 'class' =>
'FactureFournisseur',
599 'table' =>
'facture_fourn',
600 'datefieldname' =>
'datef',
601 'urlnew' => DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
602 'lang' =>
'suppliers',
603 'buttonnew' =>
'AddSupplierInvoice',
604 'testnew' => $user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'),
605 'test' =>
isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')
608 'name' =>
"Contracts",
609 'title' =>
"ListContractAssociatedProject",
610 'class' =>
'Contrat',
611 'table' =>
'contrat',
612 'datefieldname' =>
'date_contrat',
613 'urlnew' => DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
614 'lang' =>
'contracts',
615 'buttonnew' =>
'AddContract',
616 'testnew' => $user->hasRight(
'contrat',
'creer'),
617 'test' =>
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')
619 'intervention' => array(
620 'name' =>
"Interventions",
621 'title' =>
"ListFichinterAssociatedProject",
622 'class' =>
'Fichinter',
623 'table' =>
'fichinter',
624 'datefieldname' =>
'date_valid',
625 'disableamount' => 0,
627 'urlnew' => DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
628 'lang' =>
'interventions',
629 'buttonnew' =>
'AddIntervention',
630 'testnew' => $user->hasRight(
'ficheinter',
'creer'),
631 'test' =>
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')
634 'name' =>
"Shippings",
635 'title' =>
"ListShippingAssociatedProject",
636 'class' =>
'Expedition',
637 'table' =>
'expedition',
638 'datefieldname' =>
'date_valid',
639 'urlnew' => DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
640 'lang' =>
'sendings',
641 'buttonnew' =>
'CreateShipment',
643 'test' =>
isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')
647 'title' =>
"ListMOAssociatedProject",
650 'datefieldname' =>
'date_valid',
651 'urlnew' => DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
653 'buttonnew' =>
'CreateMO',
654 'testnew' => $user->hasRight(
'mrp',
'write'),
655 'project_field' =>
'fk_project',
657 'test' =>
isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')
659 'expensereport' => array(
660 'name' =>
"ExpenseReports",
661 'title' =>
"ListExpenseReportsAssociatedProject",
662 'class' =>
'ExpenseReportLine',
663 'table' =>
'expensereport_det',
664 'datefieldname' =>
'date',
666 'disableamount' => 0,
667 'urlnew' => DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
669 'buttonnew' =>
'AddTrip',
670 'testnew' => $user->hasRight(
'expensereport',
'creer'),
671 'test' =>
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')
674 'name' =>
"Donation",
675 'title' =>
"ListDonationsAssociatedProject",
679 'datefieldname' =>
'datedon',
680 'disableamount' => 0,
681 'urlnew' => DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
682 'lang' =>
'donations',
683 'buttonnew' =>
'AddDonation',
684 'testnew' => $user->hasRight(
'don',
'creer'),
685 'test' =>
isModEnabled(
'don') && $user->hasRight(
'don',
'lire')
689 'title' =>
"ListLoanAssociatedProject",
693 'datefieldname' =>
'datestart',
694 'disableamount' => 0,
695 'urlnew' => DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
697 'buttonnew' =>
'AddLoan',
698 'testnew' => $user->hasRight(
'loan',
'write'),
699 'test' =>
isModEnabled(
'loan') && $user->hasRight(
'loan',
'read')
701 'chargesociales' => array(
702 'name' =>
"SocialContribution",
703 'title' =>
"ListSocialContributionAssociatedProject",
704 'class' =>
'ChargeSociales',
706 'table' =>
'chargesociales',
707 'datefieldname' =>
'date_ech',
708 'disableamount' => 0,
709 'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
711 'buttonnew' =>
'AddSocialContribution',
712 'testnew' => $user->hasRight(
'tax',
'charges',
'lire'),
713 'test' =>
isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')
715 'project_task' => array(
716 'name' =>
"TaskTimeSpent",
717 'title' =>
"ListTaskTimeUserProject",
720 'table' =>
'projet_task',
721 'datefieldname' =>
'element_date',
722 'disableamount' => ($canSeeFinancials ? 0 : 1),
723 'urlnew' => DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
724 'buttonnew' =>
'AddTimeSpent',
725 'testnew' => $user->hasRight(
'project',
'creer'),
728 'stocktransfer' => array(
729 'name' =>
"StockTransfer",
730 'title' =>
"ListStockTransferProject",
731 'class' =>
'StockTransfer',
732 'table' =>
'stocktransfer_stocktransfer',
733 'datefieldname' =>
'datem',
735 'project_field' =>
'fk_project',
736 'disableamount' => 1,
737 'urlnew' => DOL_URL_ROOT.
'/product/stock/stocktransfer/stocktransfer_card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
739 'buttonnew' =>
'StockTransferNew',
740 'testnew' => $user->hasRight(
'stocktransfer',
'stocktransfer',
'write'),
741 'test' =>
isModEnabled(
'stocktransfer') && $user->hasRight(
'stocktransfer',
'stocktransfer',
'read')
743 'stock_mouvement' => array(
744 'name' =>
"MouvementStockAssociated",
745 'title' =>
"ListMouvementStockProject",
746 'class' =>
'StockTransfer',
747 'table' =>
'stocktransfer_stocktransfer',
748 'datefieldname' =>
'datem',
750 'project_field' =>
'fk_project',
751 'disableamount' => 0,
755 'name' =>
"Salaries",
756 'title' =>
"ListSalariesAssociatedProject",
759 'datefieldname' =>
'datesp',
761 'disableamount' => 0,
762 'urlnew' => DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
763 'lang' =>
'salaries',
764 'buttonnew' =>
'AddSalary',
765 'testnew' => $user->hasRight(
'salaries',
'write'),
766 'test' =>
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read')
768 'variouspayment' => array(
769 'name' =>
"VariousPayments",
770 'title' =>
"ListVariousPaymentsAssociatedProject",
771 'class' =>
'PaymentVarious',
772 'table' =>
'payment_various',
773 'datefieldname' =>
'datev',
775 'disableamount' => 0,
776 'urlnew' => DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
778 'buttonnew' =>
'AddVariousPayment',
779 'testnew' => $user->hasRight(
'banque',
'modifier'),
800 foreach ($listofreferent as $key => $element) {
801 if ($listofreferent[$key][
'margin'] ==
'add') {
802 unset($listofreferent[$key][
'margin']);
805 $newelementforplusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_PLUS_MARGIN'));
806 foreach ($newelementforplusmargin as $value) {
807 $listofreferent[trim($value)][
'margin'] =
'add';
811 foreach ($listofreferent as $key => $element) {
812 if ($listofreferent[$key][
'margin'] ==
'minus') {
813 unset($listofreferent[$key][
'margin']);
816 $newelementforminusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_MINUS_MARGIN'));
817 foreach ($newelementforminusmargin as $value) {
818 $listofreferent[trim($value)][
'margin'] =
'minus';
823$parameters = array(
'listofreferent' => $listofreferent);
824$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
826if (!empty($hookmanager->resArray)) {
827 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
828} elseif ($resHook > 0 && !empty($hookmanager->resPrint)) {
829 $listofreferent = $hookmanager->resPrint;
832if ($action ==
"addelement") {
833 $tablename =
GETPOST(
"tablename",
"aZ09");
834 $elementselectid =
GETPOSTINT(
"elementselect");
835 $result =
$object->update_element($tablename, $elementselectid);
839} elseif ($action ==
"unlink") {
840 $tablename =
GETPOST(
"tablename",
"aZ09");
841 $projectField = GETPOSTISSET(
'projectfield') ?
GETPOST(
'projectfield',
'aZ09') :
'fk_projet';
842 $elementselectid =
GETPOSTINT(
"elementselect");
844 $result =
$object->remove_element($tablename, $elementselectid, $projectField);
856if (!$showdatefilter) {
857 print
'<div class="center centpercent">';
858 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
859 print
'<input type="hidden" name="token" value="'.newToken().
'">';
860 print
'<input type="hidden" name="tablename" value="'.(empty($tablename) ?
'' : $tablename).
'">';
861 print
'<input type="hidden" name="action" value="view">';
862 print
'<div class="inline-block">';
863 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
865 print
'<div class="inline-block">';
866 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
868 print
'<div class="inline-block">';
869 print
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
881$langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
884 $langs->load(
'stocks');
887print
'<!-- Begin PROFIT table -->';
890print
'<div class="div-table-responsive">';
891print
'<table class="noborder centpercent">';
892print
'<tr class="liste_titre">';
893print
'<td class="left" width="200">';
894$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
895$tooltiponprofitplus = $tooltiponprofitminus =
'';
896foreach ($listofreferent as $key => $value) {
897 if (!empty($value[
'lang'])) {
898 $langs->load($value[
'lang']);
900 $name = $langs->trans($value[
'name']);
901 $qualified = $value[
'test'];
902 $margin = empty($value[
'margin']) ?
'' : $value[
'margin'];
903 if ($qualified && $margin) {
904 if ($margin ===
'add') {
905 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
906 } elseif ($margin ===
'minus') {
907 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
911$tooltiponprofit .= $tooltiponprofitplus;
912$tooltiponprofit .= $tooltiponprofitminus;
913print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
915print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
916print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
917print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
920$total_revenue_ht = 0;
925foreach ($listofreferent as $key => $value) {
927 'total_revenue_ht' => & $total_revenue_ht,
928 'balance_ht' => & $balance_ht,
929 'balance_ttc' => & $balance_ttc,
935 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
938 } elseif ($reshook > 0) {
939 print $hookmanager->resPrint;
943 $name = $langs->trans($value[
'name']);
944 $title = $value[
'title'];
945 $classname = $value[
'class'];
946 $tablename = $value[
'table'];
947 $datefieldname = $value[
'datefieldname'];
948 $qualified = $value[
'test'];
950 if ($key ===
'project_task' && !$canSeeFinancials) {
953 $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
954 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
956 $element =
new $classname(
$db);
958 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
960 if (is_array($elementarray) && count($elementarray) > 0) {
966 $num = count($elementarray);
967 for ($i = 0; $i < $num; $i++) {
968 $tmp = explode(
'_', $elementarray[$i]);
969 $idofelement = (int) $tmp[0];
970 $idofelementuser = !empty($tmp[1]) ? (int) $tmp[1] : 0;
972 $element->fetch($idofelement);
973 if ($idofelementuser) {
974 $elementuser->fetch($idofelementuser);
978 $qualifiedfortotal =
true;
979 if ($key ==
'invoice') {
980 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
981 $qualifiedfortotal =
false;
984 $qualifiedfortotal =
false;
987 $qualifiedfortotal =
false;
990 if ($key ==
'propal') {
992 $qualifiedfortotal =
false;
996 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) {
997 $element->fetch_thirdparty();
1001 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1002 '@phan-var-force ChargeSociales|PaymentVarious|Salary $element';
1003 $total_ht_by_line = $element->amount;
1004 } elseif ($tablename ==
'fichinter') {
1005 '@phan-var-force Fichinter $element';
1006 $total_ht_by_line = $element->getAmount();
1007 } elseif ($tablename ==
'stock_mouvement') {
1008 '@phan-var-force MouvementStock $element';
1009 $total_ht_by_line = $element->price * abs($element->qty);
1010 } elseif ($tablename ==
'projet_task') {
1011 '@phan-var-force Task $element';
1012 $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', (
string) $dates, (
string) $datee);
1013 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
1014 } elseif ($key ==
'loan') {
1015 '@phan-var-force Loan $element';
1016 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
1018 $total_ht_by_line = -$element->capital;
1021 $total_ht_by_line = 0;
1023 $loanScheduleStatic->fetchAll($element->id);
1024 if (!empty($loanScheduleStatic->lines)) {
1025 foreach ($loanScheduleStatic->lines as $loanSchedule) {
1029 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
1030 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
1031 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
1033 $total_ht_by_line -= $loanSchedule->amount_capital;
1039 $total_ht_by_line = $element->total_ht;
1043 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1044 '@phan-var-force ChargeSociales|PaymentVarious|Salary $element';
1045 $total_ttc_by_line = $element->amount;
1046 } elseif ($tablename ==
'fichinter') {
1047 '@phan-var-force Fichinter $element';
1048 $total_ttc_by_line = $element->getAmount();
1049 } elseif ($tablename ==
'stock_mouvement') {
1050 '@phan-var-force MouvementStock $element';
1051 $total_ttc_by_line = $element->price * abs($element->qty);
1052 } elseif ($tablename ==
'projet_task') {
1053 '@phan-var-force Task $element';
1056 if (preg_replace(
'/^(\d+\.)\s\(.*\)/', $defaultvat, $reg)) {
1058 $defaultvat = $reg[1];
1060 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ((
float) $defaultvat / 100)),
'MT');
1061 } elseif ($key ==
'loan') {
1062 $total_ttc_by_line = $total_ht_by_line;
1064 $total_ttc_by_line = $element->total_ttc;
1068 if ($tablename ==
'payment_various') {
1069 if ($element->sens == 1) {
1070 $total_ht_by_line = -$total_ht_by_line;
1071 $total_ttc_by_line = -$total_ttc_by_line;
1079 if (($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_proposal') && $margin !==
'minus') {
1080 $total_ht_by_line = -$total_ht_by_line;
1081 $total_ttc_by_line = -$total_ttc_by_line;
1085 if ($qualifiedfortotal) {
1086 $total_ht += $total_ht_by_line;
1087 $total_ttc += $total_ttc_by_line;
1095 if ($margin ===
'add') {
1096 $total_revenue_ht += $total_ht;
1099 if ($margin ===
"minus") {
1100 $total_ht = -$total_ht;
1101 $total_ttc = -$total_ttc;
1104 $balance_ht += $total_ht;
1105 $balance_ttc += $total_ttc;
1108 print
'<tr class="oddeven">';
1110 print
'<!-- // Module '.$name.
' with tablename '.$tablename.
' -->';
1111 print
'<td class="left"><a href="#table_'.$tablename.
'">'.$name.
'</a></td>';
1113 print
'<td class="right">'.$i.
'</td>';
1115 print
'<td class="right">';
1116 if ($key ==
'intervention' && !$margin) {
1117 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
1118 } elseif ($key ==
'stocktransfer') {
1119 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"NoAmountforStockTransfer")).
'</span>';
1121 if ($key ==
'propal') {
1122 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
1124 print
price($total_ht);
1128 print
'<td class="right">';
1129 if ($key ==
'intervention' && !$margin) {
1130 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
1131 } elseif ($key ==
'stocktransfer') {
1132 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"NoAmountforStockTransfer")).
'</span>';
1134 if ($key ==
'propal') {
1135 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
1137 print
price($total_ttc);
1145print
'<tr class="liste_total">';
1146print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
1147print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
1148print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
1152if (
$object->usage_organize_event) {
1153 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1155 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int)
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
1157 if (!is_array($result) && $result < 0) {
1158 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
1160 $nbAttendees = count($result);
1163 if ($nbAttendees >= 2) {
1164 $costperattendee_ht = $balance_ht / $nbAttendees;
1165 $costperattendee_ttc = $balance_ttc / $nbAttendees;
1166 print
'<tr class="liste_total">';
1167 print
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
1168 print
'<td class="right">'.price(
price2num($costperattendee_ht,
'MT')).
'</td>';
1169 print
'<td class="right">'.price(
price2num($costperattendee_ttc,
'MT')).
'</td>';
1175if ($total_revenue_ht) {
1176 print
'<tr class="liste_total">';
1177 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
1178 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
1179 print
'<td class="right"></td>';
1185print
'<!-- End PROFIT table -->';
1195foreach ($listofreferent as $key => $value) {
1196 $parameters = array(
1198 'value' => & $value,
1202 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1205 } elseif ($reshook > 0) {
1206 print $hookmanager->resPrint;
1210 $title = $value[
'title'];
1211 $classname = $value[
'class'];
1212 $tablename = $value[
'table'];
1213 $datefieldname = $value[
'datefieldname'];
1214 $qualified = $value[
'test'];
1215 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1216 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1217 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1218 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1219 $nototal = empty($value[
'nototal']) ? 0 : 1;
1221 $exclude_select_element = array(
'payment_various');
1222 if (!empty($value[
'exclude_select_element'])) {
1223 $exclude_select_element[] = $value[
'exclude_select_element'];
1226 if ($qualified && $tablename !==
null) {
1230 $element =
new $classname(
$db);
1234 $idtofilterthirdparty = 0;
1235 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1236 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1237 $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 :
$object->thirdparty->id;
1239 $idtofilterthirdparty .=
',' .
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
1243 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1246 if (!
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1247 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1248 if ((
int) $selectList < 0) {
1250 } elseif ($selectList) {
1252 $addform .=
'<div class="inline-block valignmiddle">';
1253 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1254 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1255 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1256 $addform .=
'<input type="hidden" name="action" value="addelement">';
1257 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1258 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1259 $addform .=
'<table><tr>';
1261 $addform .=
'<td>'.$selectList.
'</td>';
1262 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1263 $addform .=
'</tr></table>';
1264 $addform .=
'</form>';
1265 $addform .=
'</div>';
1269 $addform .=
'<div class="inline-block valignmiddle">';
1271 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1273 $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>';
1275 $addform .=
'<div>';
1278 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1279 $addform .=
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1280 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1283 $("#btnShow").on("click", function () {
1284 console.log("We click to show or hide the canceled lines");
1285 var attr = $(this).attr("data-canceledarehidden");
1286 if (typeof attr !== "undefined" && attr !== false) {
1287 console.log("Show canceled");
1288 $(".tr_canceled").show();
1289 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'");
1290 $("#btnShow").removeAttr("data-canceledarehidden");
1291 $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
1293 console.log("Hide canceled");
1294 $(".tr_canceled").hide();
1295 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'");
1296 $("#btnShow").attr("data-canceledarehidden", 1);
1297 $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
1302 $addform .=
'<div class="inline-block valignmiddle"><a id="btnShowPaid" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1303 <span id="textBtnShowPaid" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"PaidShown").
'</span><span id="minus-circle-paid" class="fa fa-eye valignmiddle paddingleft"></span>
1306 $("#btnShowPaid").on("click", function () {
1307 console.log("We click to show or hide the paid lines");
1308 var attr = $(this).attr("data-paidarehidden");
1309 if (typeof attr !== "undefined" && attr !== false) {
1310 console.log("Show paid");
1311 $(".tr_paid").show();
1312 $("#textBtnShowPaid").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"PaidShown")).
'");
1313 $("#btnShowPaid").removeAttr("data-paidarehidden");
1314 $("#minus-circle-paid").removeClass("fa-eye-slash").addClass("fa-eye");
1316 console.log("Hide paid");
1317 $(".tr_paid").hide();
1318 $("#textBtnShowPaid").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"PaidHidden")).
'");
1319 $("#btnShowPaid").attr("data-paidarehidden", 1);
1320 $("#minus-circle-paid").removeClass("fa-eye").addClass("fa-eye-slash");
1326 print
'<a id="table_'.$tablename.
'"></a>';
1329 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
1330 print
'<div class="div-table-responsive">';
1331 print
'<table class="noborder centpercent">';
1333 print
'<tr class="liste_titre">';
1334 $stocktransfercolstyle = ($key ==
'stocktransfer' ?
' style="width: 9%"' :
'');
1336 print
'<td style="width: 24px"></td>';
1338 if ($key ==
'stocktransfer') {
1339 print
'<td'.$stocktransfercolstyle.
'>'.$langs->trans(
"Ref").
'</td>';
1341 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
1344 if (
'MouvementStock' == $classname) {
1345 print
'<td style="width: 200px">'.$langs->trans(
"Product").
'</td>';
1346 print
'<td style="width: 50px">'.$langs->trans(
"Qty").
'</td>';
1349 if ($key !=
'stocktransfer') {
1350 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
1351 if (in_array($tablename, array(
'projet_task'))) {
1352 print $langs->trans(
"TimeSpent");
1354 if (!in_array($tablename, array(
'projet_task'))) {
1355 print $langs->trans(
"Date");
1359 if ($key ==
'stocktransfer') {
1360 print
'<td'.$stocktransfercolstyle.
'>'.$langs->trans(
"WarehouseSource").
'</td>';
1361 print
'<td'.$stocktransfercolstyle.
'>'.$langs->trans(
"WarehouseDestination").
'</td>';
1362 print
'<td class="center"'.$stocktransfercolstyle.
'>'.$langs->trans(
"DatePrevueDepart").
'</td>';
1363 print
'<td class="center"'.$stocktransfercolstyle.
'>'.$langs->trans(
"DateReelleDepart").
'</td>';
1364 print
'<td class="center"'.$stocktransfercolstyle.
'>'.$langs->trans(
"DatePrevueArrivee").
'</td>';
1365 print
'<td class="center"'.$stocktransfercolstyle.
'>'.$langs->trans(
"DateReelleArrivee").
'</td>';
1368 print
'<td'.($key ==
'stocktransfer' ? $stocktransfercolstyle :
'').
'>';
1369 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') {
1371 } elseif (in_array($tablename, array(
'payment_various'))) {
1372 print $langs->trans(
"Label");
1373 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1374 print $langs->trans(
"User");
1376 print $langs->trans(
"ThirdParty");
1380 if ($tablename ==
'fichinter') {
1382 print $langs->trans(
"TotalDuration");
1383 $total_duration = 0;
1387 if ($tablename ==
'expensereport_det') {
1388 print
'<td id="expensereport_type">';
1389 print $langs->trans(
"Type");
1393 if ($tablename ==
'expensereport_det') {
1394 print
'<td id="expensereport_description">';
1395 print $langs->trans(
"Description");
1403 if ($key ==
'loan') {
1404 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1405 } elseif (empty($value[
'disableamount'])) {
1406 if ($key ==
'stocktransfer') {
1407 print
'<td class="right"'.$stocktransfercolstyle.
'>'.$langs->trans(
"AmountHT").
'</td>';
1409 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1412 if ($key ==
'stocktransfer') {
1413 print
'<td'.$stocktransfercolstyle.
'></td>';
1415 print
'<td width="120"></td>';
1420 if ($key ==
'loan') {
1421 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1422 } elseif (empty($value[
'disableamount'])) {
1423 if ($key ==
'stocktransfer') {
1424 print
'<td class="right"'.$stocktransfercolstyle.
'>'.$langs->trans(
"AmountTTC").
'</td>';
1426 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1429 if ($key ==
'stocktransfer') {
1430 print
'<td'.$stocktransfercolstyle.
'></td>';
1432 print
'<td width="120"></td>';
1436 if (in_array($tablename, array(
'projet_task'))) {
1437 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1439 if ($key ==
'stocktransfer') {
1440 print
'<td class="right"'.$stocktransfercolstyle.
'>'.$langs->trans(
"Status").
'</td>';
1442 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1447 if (is_array($elementarray) && count($elementarray) > 0) {
1452 $total_ht_by_third = 0;
1453 $total_ttc_by_third = 0;
1455 $saved_third_id = 0;
1463 $num = count($elementarray);
1465 for ($i = 0; $i < $num; $i++) {
1466 $tmp = explode(
'_', $elementarray[$i]);
1467 $idofelement = (int) $tmp[0];
1468 $idofelementuser = isset($tmp[1]) ? (int) $tmp[1] : 0;
1470 $element->fetch($idofelement);
1471 if ($idofelementuser) {
1472 $elementuser->fetch($idofelementuser);
1476 if ($tablename !=
'expensereport_det') {
1477 if (method_exists($element,
'fetch_thirdparty')) {
1478 $element->fetch_thirdparty();
1482 $expensereport->fetch($element->fk_expensereport);
1487 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1490 $saved_third_id = $element->thirdparty->id;
1493 $total_ht_by_third = 0;
1494 $total_ttc_by_third = 0;
1497 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1499 $qualifiedfortotal =
true;
1500 if ($key ==
'invoice') {
1501 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1502 $qualifiedfortotal =
false;
1504 } elseif ($key ==
'order_supplier' && ($element->status == 6 || $element->status == 7)) {
1505 $qualifiedfortotal =
false;
1508 if ($key ==
"order_supplier" && ($element->status == 6 || $element->status == 7)) {
1509 print
'<tr class="oddeven tr_canceled">';
1510 } elseif ($key ==
"order_supplier" && ($element->billed)) {
1511 print
'<tr class="oddeven tr_paid">';
1513 print
'<tr class="oddeven" >';
1518 print
'<td style="width: 24px">';
1519 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1521 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1522 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1529 print
'<td class="left nowraponall">';
1530 if ($tablename ==
'expensereport_det') {
1531 print $expensereport->getNomUrl(1);
1533 print
'<table><tr><td style="border-bottom: none;">';
1535 if ($element instanceof
Task) {
1536 print $element->getNomUrl(1,
'withproject',
'time');
1537 print
' - '.dol_trunc($element->label, 48);
1538 } elseif ($key ==
'loan') {
1539 print $element->getNomUrl(1);
1540 print
' - '.dol_trunc($element->label, 48);
1542 print $element->getNomUrl(1);
1545 $element_doc = $element->element;
1547 if (!empty(
$conf->$element_doc)) {
1548 $confelementdoc =
$conf->$element_doc;
1554 if ($element_doc ===
'order_supplier') {
1555 $element_doc =
'commande_fournisseur';
1557 } elseif ($element_doc ===
'invoice_supplier') {
1558 $element_doc =
'facture_fournisseur';
1559 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1560 $filedir =
$conf->fournisseur->facture->multidir_output[$element->entity ??
$conf->entity].
'/'.$filename;
1563 print
'<div class="inline-block valignmiddle">';
1565 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1571 print
'<td class="tdoverflowmax250" style="border-bottom: none;">';
1574 if (!empty($element->ref_supplier)) {
1575 print
' - '.$element->ref_supplier;
1578 if (!empty($element->ref_customer)) {
1579 print
' - '.$element->ref_customer;
1582 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1583 print
' - '.$element->ref_client;
1586 print
'</td></tr></table>';
1590 if (
'MouvementStock' == $classname) {
1591 '@phan-var-force MouvementStock $element';
1592 $mvsProd =
new Product($element->db);
1593 $mvsProd->fetch($element->product_id);
1594 print
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
1595 print
'<td>'.$element->qty.
'</td>';
1599 $total_time_by_line = 0;
1600 if ($tablename ==
'expensereport_det') {
1601 '@phan-var-force ExpenseReportLine $element';
1602 $date = $element->date;
1603 } elseif ($tablename ==
'stock_mouvement') {
1604 '@phan-var-force MouvementStock $element';
1605 $date = $element->datem;
1606 } elseif ($tablename ==
'salary') {
1607 '@phan-var-force Salary $element';
1608 $date = $element->datesp;
1609 } elseif ($tablename ==
'payment_various') {
1610 '@phan-var-force PaymentVarious $element';
1611 $date = $element->datev;
1612 } elseif ($tablename ==
'chargesociales') {
1613 '@phan-var-force ChargeSociales $element';
1614 $date = $element->date_ech;
1615 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1616 if ($tablename ==
'don') {
1617 '@phan-var-force Don $element';
1618 $date = $element->date;
1620 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1621 '@phan-var-force CommandeFournisseur $element';
1622 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1623 } elseif ($tablename ==
'supplier_proposal') {
1624 '@phan-var-force SupplierProposal $element';
1625 $date = $element->date_validation;
1626 } elseif ($tablename ==
'fichinter') {
1627 '@phan-var-force Fichinter $element';
1628 $date = $element->datev;
1629 } elseif ($tablename ==
'projet_task') {
1630 '@phan-var-force Task $element';
1633 $date = $element->date;
1635 $date = $element->date_contrat;
1638 $date = $element->datev;
1640 if (empty($date) && !empty($datefieldname)) {
1642 $date = $element->$datefieldname;
1645 } elseif ($key ==
'loan') {
1646 '@phan-var-force Loan $element';
1647 $date = $element->datestart;
1650 if ($key !=
'stocktransfer') {
1651 print
'<td class="center">';
1652 if ($tablename ==
'actioncomm') {
1653 '@phan-var-force ActionComm $element';
1655 if ($element->datef && $element->datef > $element->datep) {
1656 print
" - ".dol_print_date($element->datef,
'dayhour');
1658 } elseif (in_array($tablename, array(
'projet_task'))) {
1659 '@phan-var-force Task $element';
1660 $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', (
string) $dates, (
string) $datee);
1661 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1664 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1671 if ($key ==
'stocktransfer') {
1674 print
'<td class="tdoverflowmax150">';
1675 if (!empty($element->fk_warehouse_source) && $warehouseSource->fetch($element->fk_warehouse_source) > 0) {
1676 print $warehouseSource->getNomUrl(1);
1679 print
'<td class="tdoverflowmax150">';
1680 if (!empty($element->fk_warehouse_destination) && $warehouseDestination->fetch($element->fk_warehouse_destination) > 0) {
1681 print $warehouseDestination->getNomUrl(1);
1684 print
'<td class="center">'.dol_print_date($element->date_prevue_depart,
'day').
'</td>';
1685 print
'<td class="center">'.dol_print_date($element->date_reelle_depart,
'day').
'</td>';
1686 print
'<td class="center">'.dol_print_date($element->date_prevue_arrivee,
'day').
'</td>';
1687 print
'<td class="center">'.dol_print_date($element->date_reelle_arrivee,
'day').
'</td>';
1691 print
'<td class="tdoverflowmax150">';
1692 if (is_object($element->thirdparty)) {
1693 print $element->thirdparty->getNomUrl(1,
'', 48);
1694 } elseif ($tablename ==
'expensereport_det') {
1696 $tmpuser->fetch($expensereport->fk_user_author);
1697 print $tmpuser->getNomUrl(1,
'', 48);
1698 } elseif ($tablename ==
'salary') {
1700 $tmpuser->fetch($element->fk_user);
1701 print $tmpuser->getNomUrl(1,
'', 48);
1702 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1703 '@phan-var-force Don|MouvementStock $element';
1704 if ($element->fk_user_author > 0) {
1706 $tmpuser2->fetch($element->fk_user_author);
1707 print $tmpuser2->getNomUrl(1,
'', 48);
1709 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1710 print $elementuser->getNomUrl(1);
1711 } elseif ($tablename ==
'payment_various') {
1712 '@phan-var-force PaymentVarious $element';
1713 print $element->label;
1718 if ($tablename ==
'fichinter') {
1719 '@phan-var-force FichInter $element';
1722 $total_duration += $element->duration;
1727 if ($tablename ==
'expensereport_det') {
1728 print
'<td class="left linecoltype">';
1729 $labeltype = ($langs->trans(($element->type_fees_code)) == $element->type_fees_code ? $element->type_fees_libelle : $langs->trans($element->type_fees_code));
1730 print (
string) $labeltype;
1734 if ($tablename ==
'expensereport_det') {
1735 print
'<td class="left linecolcomment">';
1736 print (
string) $element->comments;
1743 if (empty($value[
'disableamount'])) {
1744 $total_ht_by_line =
null;
1746 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1747 '@phan-var-force Don|ChargeSociales|PaymentVarious|Salary $element';
1748 $total_ht_by_line = $element->amount;
1749 } elseif ($tablename ==
'fichinter') {
1750 '@phan-var-force FichInter $element';
1751 $total_ht_by_line = $element->getAmount();
1752 } elseif ($tablename ==
'stock_mouvement') {
1753 '@phan-var-force MouvementStock $element';
1754 $total_ht_by_line = $element->price * abs($element->qty);
1755 } elseif (in_array($tablename, array(
'projet_task'))) {
1758 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1759 if (isset($tmpprojtime[
'nblinesnull']) && ($tmpprojtime[
'nblinesnull'] > 0)) {
1760 $langs->load(
"errors");
1761 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate",
$conf->currency);
1764 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1766 } elseif ($key ==
'loan') {
1767 '@phan-var-force Loan $element';
1768 $total_ht_by_line = $element->capital;
1770 $total_ht_by_line = $element->total_ht;
1774 if ($tablename ==
'payment_various') {
1775 if ($element->sens == 0) {
1776 $total_ht_by_line = -$total_ht_by_line;
1780 print
'<td class="right">';
1781 if ($othermessage) {
1782 print
'<span class="opacitymedium">'.$othermessage.
'</span>';
1784 if (isset($total_ht_by_line)) {
1785 if (!$qualifiedfortotal) {
1788 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1789 if (!$qualifiedfortotal) {
1794 print
' '.img_warning($warning);
1796 if (isset($tmpprojtime[
'nblinesnull']) && ($tmpprojtime[
'nblinesnull'] > 0)) {
1797 if ($tmpprojtime[
'nbuserthmnull'] > 0) {
1798 $title = $langs->trans(
"EnterUsersHourlyRateFirst");
1799 print
' '.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'opacitymedium');
1801 $title = $langs->trans(
"UpdateUndefinedWithLastHourlyRate");
1802 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateundefinedwithlasthourlyrate&taskid='.$idofelement.
'&token='.currentToken().
'">'.
img_picto($title,
"sync",
'', 0, 0, 0,
'',
'warning').
'</a>';
1805 if (
getDolGlobalString(
'PROJECT_CAN_OVERWRITE_TIMESTPENT_HOURLY_RATE_WITH_LASTONE')) {
1806 $title = $langs->trans(
"UpdateWithLastHourlyRate");
1807 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateallwithlasthourlyrate&taskid='.$idofelement.
'&token='.currentToken().
'">'.
img_picto($title,
"sync",
'', 0, 0, 0,
'',
'').
'</a>';
1815 if (empty($value[
'disableamount'])) {
1816 $total_ttc_by_line =
null;
1817 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1818 '@phan-var-force Don|ChargeSociales|PaymentVarious $element';
1819 $total_ttc_by_line = $element->amount;
1820 } elseif ($tablename ==
'fichinter') {
1821 '@phan-var-force Fichinter $element';
1822 $total_ttc_by_line = $element->getAmount();
1823 } elseif ($tablename ==
'stock_mouvement') {
1824 '@phan-var-force MouvementStock $element';
1825 $total_ttc_by_line = $element->price * abs($element->qty);
1826 } elseif ($tablename ==
'projet_task') {
1830 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1832 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1834 } elseif ($key ==
'loan') {
1835 '@phan-var-force Loan $element';
1836 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1838 $total_ttc_by_line = $element->total_ttc;
1842 if ($tablename ==
'payment_various') {
1843 if ($element->sens == 0) {
1844 $total_ttc_by_line = -$total_ttc_by_line;
1848 print
'<td class="right">';
1849 if ($othermessage) {
1850 print $othermessage;
1852 if (isset($total_ttc_by_line)) {
1853 if (!$qualifiedfortotal) {
1856 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1857 if (!$qualifiedfortotal) {
1862 print
' '.img_warning($warning);
1864 if (isset($tmpprojtime[
'nblinesnull']) && ($tmpprojtime[
'nblinesnull'] > 0)) {
1865 if ($tmpprojtime[
'nbuserthmnull'] > 0) {
1866 $title = $langs->trans(
"EnterUsersHourlyRateFirst");
1867 print
' '.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'opacitymedium');
1869 $title = $langs->trans(
"UpdateUndefinedWithLastHourlyRate");
1870 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateundefinedwithlasthourlyrate&taskid='.$idofelement.
'&token='.currentToken().
'">'.
img_picto($title,
"sync",
'', 0, 0, 0,
'',
'warning').
'</a>';
1873 if (
getDolGlobalString(
'PROJECT_CAN_OVERWRITE_TIMESTPENT_HOURLY_RATE_WITH_LASTONE')) {
1874 $title = $langs->trans(
"UpdateWithLastHourlyRate");
1875 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateallwithlasthourlyrate&taskid='.$idofelement.
'&token='.currentToken().
'">'.
img_picto($title,
"sync").
'</a>';
1883 print
'<td class="right">';
1884 if ($tablename ==
'expensereport_det') {
1885 print $expensereport->getLibStatut(5);
1888 print $element->getLibStatut(5, $element->getSommePaiement());
1889 } elseif ($element instanceof
Task) {
1890 if ($element->progress !=
'') {
1891 print $element->progress.
' %';
1893 } elseif ($tablename ==
'stock_mouvement') {
1894 '@phan-var-force MouvementStock $element';
1895 print $element->getLibStatut(3);
1897 print $element->getLibStatut(5);
1903 if ($qualifiedfortotal) {
1904 $total_ht += $total_ht_by_line;
1905 $total_ttc += $total_ttc_by_line;
1907 $total_ht_by_third += $total_ht_by_line;
1908 $total_ttc_by_third += $total_ttc_by_line;
1910 if (!isset($total_time)) {
1911 $total_time = $total_time_by_line;
1913 $total_time += $total_time_by_line;
1918 $breakline =
'<tr class="liste_total liste_sub_total">';
1919 $breakline .=
'<td colspan="2">';
1920 $breakline .=
'</td>';
1921 $breakline .=
'<td>';
1922 $breakline .=
'</td>';
1923 $breakline .=
'<td class="right">';
1924 $breakline .= $langs->trans(
'SubTotal').
' : ';
1925 if (is_object($element->thirdparty)) {
1926 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1928 $breakline .=
'</td>';
1929 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1930 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1931 $breakline .=
'<td></td>';
1932 $breakline .=
'</tr>';
1943 if (empty($nototal)) {
1945 if (in_array($tablename, array(
'projet_task'))) {
1948 if ($key ==
'stocktransfer') {
1952 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1953 if (in_array($tablename, array(
'projet_task'))) {
1954 print
'<td class="center">';
1963 if ($tablename ==
'fichinter') {
1964 print
'<td class="left">'.convertSecondToTime($total_duration,
'all',
$conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1966 print
'<td class="right">';
1967 if (empty($value[
'disableamount'])) {
1968 if ($key ==
'loan') {
1969 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1970 } elseif ($tablename !=
'projet_task' ||
isModEnabled(
'salaries')) {
1971 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
1977 print
'<td class="right">';
1978 if (empty($value[
'disableamount'])) {
1979 if ($key ==
'loan') {
1980 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1981 } elseif ($tablename !=
'projet_task' ||
isModEnabled(
'salaries')) {
1982 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
1986 print
'<td> </td>';
1988 if ($tablename ==
'expensereport_det') {
1989 print
'<td> </td>';
1990 print
'<td> </td>';
1995 if (!is_array($elementarray)) {
1996 print
'<tr><td>'.$elementarray.
'</td></tr>';
1999 if ($tablename ==
'fichinter') {
2002 if ($key ==
'stocktransfer') {
2005 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
2015if (
$conf->use_javascript_ajax) {
2016 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
2019 print $comboenhancement;
2041 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
2052 global
$db, $classname;
2053 '@phan-var-force string $classname';
2055 $element =
new $classname(
$db);
2056 '@phan-var-force CommonObject $element';
2058 $clientname = array();
2059 foreach ($elementarray as $key =>
$id) {
2060 if (empty($clientname[
$id])) {
2061 $element->fetch(
$id);
2062 $element->fetch_thirdparty();
2064 $clientname[
$id] = $element->thirdparty->name;
2071 $elementarray = array();
2072 foreach ($clientname as
$id => $name) {
2073 $elementarray[] =
$id;
2076 return $elementarray;
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Superclass for invoice classes.
Class for ConferenceOrBoothAttendee.
Class to manage warehouses.
Class to manage Trips and Expenses.
const TYPE_DEPOSIT
Deposit invoice.
const STATUS_CLOSED
Classified paid.
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_now($mode='gmt')
Return date for now.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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.