dolibarr  x.y.z
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
4  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2014 Jean Heimburger <jean@tiaris.info>
8  * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
9  * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
10  * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>.
24  */
25 
32 // Load Dolibarr environment
33 require '../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
40 if (isModEnabled('adherent')) {
41  require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
42 }
43 if (isModEnabled('categorie')) {
44  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
45 }
46 
47 // Load translation files required by page
48 $langs->loadLangs(array(
49  'companies',
50  'suppliers',
51  'products',
52  'bills',
53  'orders',
54  'commercial',
55 ));
56 
57 $action = GETPOST('action', 'aZ09');
58 $cancel = GETPOST('cancel', 'alpha');
59 
60 // Security check
61 $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
62 if ($user->socid) {
63  $id = $user->socid;
64 }
65 $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe', '', 'rowid');
66 
67 $object = new Fournisseur($db);
68 $extrafields = new ExtraFields($db);
69 
70 // fetch optionals attributes and labels
71 $extrafields->fetch_name_optionals_label($object->table_element);
72 
73 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
74 $hookmanager->initHooks(array('thirdpartysupplier', 'globalcard'));
75 
76 // Security check
77 $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
78 
79 if ($object->id > 0) {
80  if (!($object->fournisseur > 0) || empty($user->rights->fournisseur->lire)) {
82  }
83 }
84 
85 
86 /*
87  * Action
88  */
89 
90 $parameters = array('id'=>$id);
91 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
92 if ($reshook < 0) {
93  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
94 }
95 
96 if (empty($reshook)) {
97  if ($cancel) {
98  $action = "";
99  }
100 
101  if ($action == 'setsupplieraccountancycode') {
102  $result = $object->fetch($id);
103  $object->code_compta_fournisseur = GETPOST("supplieraccountancycode");
104  $result = $object->update($object->id, $user, 1, 0, 1);
105  if ($result < 0) {
106  setEventMessages($object->error, $object->errors, 'errors');
107  }
108  }
109  // Set payment terms of the settlement
110  if ($action == 'setconditions' && $user->rights->societe->creer) {
111  $object->fetch($id);
112  $result = $object->setPaymentTerms(GETPOST('cond_reglement_supplier_id', 'int'));
113  if ($result < 0) {
114  dol_print_error($db, $object->error);
115  }
116  }
117  // Payment mode
118  if ($action == 'setmode' && $user->rights->societe->creer) {
119  $object->fetch($id);
120  $result = $object->setPaymentMethods(GETPOST('mode_reglement_supplier_id', 'int'));
121  if ($result < 0) {
122  dol_print_error($db, $object->error);
123  }
124  }
125 
126  // Bank account
127  if ($action == 'setbankaccount' && $user->rights->societe->creer) {
128  $object->fetch($id);
129  $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
130  if ($result < 0) {
131  setEventMessages($object->error, $object->errors, 'errors');
132  }
133  }
134 
135  // update supplier order min amount
136  if ($action == 'setsupplier_order_min_amount') {
137  $object->fetch($id);
138  $object->supplier_order_min_amount = price2num(GETPOST('supplier_order_min_amount', 'alpha'));
139  $result = $object->update($object->id, $user);
140  if ($result < 0) {
141  setEventMessages($object->error, $object->errors, 'errors');
142  }
143  }
144 
145  if ($action == 'update_extras') {
146  $object->fetch($id);
147 
148  $object->oldcopy = dol_clone($object);
149 
150  // Fill array 'array_options' with data from update form
151  $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
152 
153  if ($ret < 0) {
154  $error++;
155  }
156 
157  if (!$error) {
158  $result = $object->insertExtraFields('COMPANY_MODIFY');
159  if ($result < 0) {
160  setEventMessages($object->error, $object->errors, 'errors');
161  $error++;
162  }
163  }
164 
165  if ($error) {
166  $action = 'edit_extras';
167  }
168  }
169 }
170 
171 
172 /*
173  * View
174  */
175 
176 $contactstatic = new Contact($db);
177 $form = new Form($db);
178 
179 if ($id > 0 && empty($object->id)) {
180  // Load data of third party
181  $res = $object->fetch($id);
182  if ($object->id <= 0) {
183  dol_print_error($db, $object->error);
184  exit(-1);
185  }
186 }
187 
188 if ($object->id > 0) {
189  $title = $langs->trans("ThirdParty")." - ".$langs->trans('Supplier');
190  if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
191  $title = $object->name." - ".$langs->trans('Supplier');
192  }
193  $help_url = '';
194  llxHeader('', $title, $help_url);
195 
196  /*
197  * Show tabs
198  */
199  $head = societe_prepare_head($object);
200 
201  print dol_get_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), -1, 'company');
202 
203  $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
204 
205  dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
206 
207  print '<div class="fichecenter"><div class="fichehalfleft">';
208 
209  print '<div class="underbanner clearboth"></div>';
210  print '<table class="border centpercent tableforfield">';
211 
212  // Type Prospect/Customer/Supplier
213  print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
214  print $object->getTypeUrl(1);
215  print '</td></tr>';
216 
217  if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
218  print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
219  }
220 
221  if ($object->fournisseur) {
222  print '<tr>';
223  print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>';
224  print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
225  $tmpcheck = $object->check_codefournisseur();
226  if ($tmpcheck != 0 && $tmpcheck != -5) {
227  print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
228  }
229  print '</td>';
230  print '</tr>';
231 
232  $langs->load('compta');
233  print '<tr>';
234  print '<td>';
235  print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->hasRight('societe', 'creer'));
236  print '</td><td>';
237  print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->hasRight('societe', 'creer'));
238  print '</td>';
239  print '</tr>';
240  }
241 
242  // Assujetti a TVA ou pas
243  print '<tr>';
244  print '<td class="titlefield">';
245  print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling'));
246  print '</td><td>';
247  print yn($object->tva_assuj);
248  print '</td>';
249  print '</tr>';
250 
251  // Local Taxes
252  if ($mysoc->useLocalTax(1)) {
253  print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
254  print yn($object->localtax1_assuj);
255  print '</td></tr>';
256  }
257  if ($mysoc->useLocalTax(2)) {
258  print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
259  print yn($object->localtax2_assuj);
260  print '</td></tr>';
261  }
262 
263  // TVA Intra
264  print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
265  print showValueWithClipboardCPButton(dol_escape_htmltag($object->tva_intra));
266  print '</td></tr>';
267 
268  // Default terms of the settlement
269  $langs->load('bills');
270  $form = new Form($db);
271  print '<tr><td>';
272  print '<table width="100%" class="nobordernopadding"><tr><td>';
273  print $langs->trans('PaymentConditions');
274  print '<td>';
275  if (($action != 'editconditions') && $user->hasRight('societe', 'creer')) {
276  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
277  }
278  print '</tr></table>';
279  print '</td><td>';
280  if ($action == 'editconditions') {
281  $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', 1);
282  } else {
283  $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'none');
284  }
285  print "</td>";
286  print '</tr>';
287 
288  // Default payment mode
289  print '<tr><td class="nowrap">';
290  print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
291  print $langs->trans('PaymentMode');
292  print '<td>';
293  if (($action != 'editmode') && $user->hasRight('societe', 'creer')) {
294  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
295  }
296  print '</tr></table>';
297  print '</td><td>';
298  if ($action == 'editmode') {
299  $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1);
300  } else {
301  $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'none');
302  }
303  print "</td>";
304  print '</tr>';
305 
306  if (isModEnabled("banque")) {
307  // Default bank account for payments
308  print '<tr><td class="nowrap">';
309  print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
310  print $langs->trans('PaymentBankAccount');
311  print '<td>';
312  if (($action != 'editbankaccount') && $user->hasRight('societe', 'creer')) {
313  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
314  }
315  print '</tr></table>';
316  print '</td><td>';
317  if ($action == 'editbankaccount') {
318  $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1);
319  } else {
320  $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none');
321  }
322  print "</td>";
323  print '</tr>';
324  }
325 
326  // Relative discounts (Discounts-Drawbacks-Rebates)
327  print '<tr><td class="nowrap">';
328  print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
329  print $langs->trans("CustomerRelativeDiscountShort");
330  print '<td><td class="right">';
331  if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
332  print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
333  }
334  print '</td></tr></table>';
335  print '</td><td>'.($object->remise_supplier_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_supplier_percent.'%</a>' : '').'</td>';
336  print '</tr>';
337 
338  // Absolute discounts (Discounts-Drawbacks-Rebates)
339  print '<tr><td class="nowrap">';
340  print '<table width="100%" class="nobordernopadding">';
341  print '<tr><td class="nowrap">';
342  print $langs->trans("CustomerAbsoluteDiscountShort");
343  print '<td><td class="right">';
344  if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
345  print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
346  }
347  print '</td></tr></table>';
348  print '</td>';
349  print '<td>';
350  $amount_discount = $object->getAvailableDiscounts('', '', 0, 1);
351  if ($amount_discount < 0) {
352  dol_print_error($db, $object->error);
353  }
354  if ($amount_discount > 0) {
355  print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
356  }
357  //else print $langs->trans("DiscountNone");
358  print '</td>';
359  print '</tr>';
360 
361  if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) {
362  print '<tr class="nowrap">';
363  print '<td>';
364  print $form->editfieldkey("OrderMinAmount", 'supplier_order_min_amount', $object->supplier_order_min_amount, $object, $user->rights->societe->creer);
365  print '</td><td>';
366  $limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
367  print $form->editfieldval("OrderMinAmount", 'supplier_order_min_amount', $object->supplier_order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
368  print '</td>';
369  print '</tr>';
370  }
371 
372  // Categories
373  if (isModEnabled('categorie')) {
374  $langs->load("categories");
375  print '<tr><td>'.$langs->trans("SuppliersCategoriesShort").'</td>';
376  print '<td>';
377  print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);
378  print "</td></tr>";
379  }
380 
381  // Other attributes
382  $parameters = array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
383  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
384 
385  // Module Adherent
386  if (isModEnabled('adherent')) {
387  $langs->load("members");
388  $langs->load("users");
389  print '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
390  print '<td>';
391  $adh = new Adherent($db);
392  $result = $adh->fetch('', '', $object->id);
393  if ($result > 0) {
394  $adh->ref = $adh->getFullName($langs);
395  print $adh->getNomUrl(1);
396  } else {
397  print $langs->trans("ThirdpartyNotLinkedToMember");
398  }
399  print '</td>';
400  print "</tr>\n";
401  }
402 
403  print '</table>';
404 
405 
406  print '</div><div class="fichehalfright">';
407 
408  $boxstat = '';
409 
410  // Nbre max d'elements des petites listes
411  $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
412 
413  print '<div class="underbanner underbanner-before-box clearboth"></div>';
414 
415  // Lien recap
416  $boxstat .= '<div class="box box-halfright">';
417  $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
418  $boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
419 
420  if (isModEnabled('supplier_proposal')) {
421  // Box proposals
422  $tmp = $object->getOutstandingProposals('supplier');
423  $outstandingOpened = $tmp['opened'];
424  $outstandingTotal = $tmp['total_ht'];
425  $outstandingTotalIncTax = $tmp['total_ttc'];
426  $text = $langs->trans("OverAllSupplierProposals");
427  $link = DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id;
428  $icon = 'bill';
429  if ($link) {
430  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
431  }
432  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
433  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
434  $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
435  $boxstat .= '</div>';
436  if ($link) {
437  $boxstat .= '</a>';
438  }
439  }
440 
441  if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
442  // Box proposals
443  $tmp = $object->getOutstandingOrders('supplier');
444  $outstandingOpened = $tmp['opened'];
445  $outstandingTotal = $tmp['total_ht'];
446  $outstandingTotalIncTax = $tmp['total_ttc'];
447  $text = $langs->trans("OverAllOrders");
448  $link = DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id;
449  $icon = 'bill';
450  if ($link) {
451  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
452  }
453  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
454  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
455  $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
456  $boxstat .= '</div>';
457  if ($link) {
458  $boxstat .= '</a>';
459  }
460  }
461 
462  if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice")) {
463  $warn = '';
464  $tmp = $object->getOutstandingBills('supplier');
465  $outstandingOpened = $tmp['opened'];
466  $outstandingTotal = $tmp['total_ht'];
467  $outstandingTotalIncTax = $tmp['total_ttc'];
468 
469  $text = $langs->trans("OverAllInvoices");
470  $link = DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id;
471  $icon = 'bill';
472  if ($link) {
473  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
474  }
475  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
476  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
477  $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
478  $boxstat .= '</div>';
479  if ($link) {
480  $boxstat .= '</a>';
481  }
482 
483  // Box outstanding bill
484  $text = $langs->trans("CurrentOutstandingBill");
485  $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
486  $icon = 'bill';
487  if ($link) {
488  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
489  }
490  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
491  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
492  $boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
493  $boxstat .= '</div>';
494  if ($link) {
495  $boxstat .= '</a>';
496  }
497 
498  $tmp = $object->getOutstandingBills('supplier', 1);
499  $outstandingOpenedLate = $tmp['opened'];
500  if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
501  $text = $langs->trans("CurrentOutstandingBillLate");
502  $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
503  $icon = 'bill';
504  if ($link) {
505  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
506  }
507  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
508  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
509  $boxstat .= '<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
510  $boxstat .= '</div>';
511  if ($link) {
512  $boxstat .= '</a>';
513  }
514  }
515  }
516 
517 
518  $parameters = array();
519  $reshook = $hookmanager->executeHooks('addMoreBoxStatsSupplier', $parameters, $object, $action);
520  if (empty($reshook)) {
521  $boxstat .= $hookmanager->resPrint;
522  }
523 
524  $boxstat .= '</td></tr>';
525  $boxstat .= '</table>';
526  $boxstat .= '</div>';
527 
528  print $boxstat;
529 
530 
531  $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
532 
533  // Lien recap
534  /*
535  print '<table class="noborder centpercent">';
536  print '<tr class="liste_titre">';
537  print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
538  print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id.'">'.$langs->trans("ShowSupplierPreview").'</a></td></tr></table></td>';
539  print '</tr>';
540  print '</table>';
541  print '<br>';
542  */
543 
544  /*
545  * List of products
546  */
547  if (isModEnabled("product") || isModEnabled("service")) {
548  $langs->load("products");
549  //Query from product/liste.php
550  $sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.entity, p.tosell as status, p.tobuy as status_buy, p.tobatch as status_batch,';
551  $sql .= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice';
552  $sql .= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
553  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
554  $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
555  $sql .= ' AND pfp.fk_soc = '.((int) $object->id);
556  $sql .= $db->order('pfp.tms', 'desc');
557  $sql .= $db->plimit($MAXLIST);
558 
559  $query = $db->query($sql);
560  if (!$query) {
561  dol_print_error($db);
562  }
563 
564  $num = $db->num_rows($query);
565 
566  print '<div class="div-table-responsive-no-min">';
567  print '<table class="noborder centpercent lastrecordtable">';
568  print '<tr class="liste_titre'.(($num == 0) ? ' nobottom' : '').'">';
569  print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td class="right">';
570  print '<a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/product/list.php?fourn_id='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllProductReferencesOfSupplier").'</span><span class="badge marginleftonlyshort">'.$object->nbOfProductRefs().'</span>';
571  print '</a></td></tr>';
572 
573  $return = array();
574  if ($num > 0) {
575  $productstatic = new Product($db);
576 
577  while ($objp = $db->fetch_object($query)) {
578  $productstatic->id = $objp->rowid;
579  $productstatic->ref = $objp->ref;
580  $productstatic->label = $objp->label;
581  $productstatic->type = $objp->fk_product_type;
582  $productstatic->entity = $objp->entity;
583  $productstatic->status = $objp->status;
584  $productstatic->status_buy = $objp->status_buy;
585  $productstatic->status_batch = $objp->status_batch;
586 
587  print '<tr class="oddeven">';
588  print '<td class="nowrap">';
589  print $productstatic->getNomUrl(1);
590  print '</td>';
591  print '<td>';
592  print dol_escape_htmltag($objp->supplier_ref);
593  print '</td>';
594  print '<td class="maxwidthonsmartphone">';
595  print dol_trunc(dol_htmlentities($objp->label), 30);
596  print '</td>';
597  //print '<td class="right" class="nowrap">'.dol_print_date($objp->tms, 'day').'</td>';
598  print '<td class="right">';
599  //print (isset($objp->unitprice) ? price($objp->unitprice) : '');
600  if (isset($objp->price)) {
601  print '<span class="amount">'.price($objp->price).'</span>';
602  if ($objp->quantity > 1) {
603  print ' / ';
604  print $objp->quantity;
605  }
606  }
607  print '</td>';
608  print '</tr>';
609  }
610  }
611 
612  print '</table>';
613  print '</div>';
614  }
615 
616 
617  /*
618  * Latest supplier proposal
619  */
620  $proposalstatic = new SupplierProposal($db);
621 
622  if (!empty($user->rights->supplier_proposal->lire)) {
623  $langs->loadLangs(array("supplier_proposal"));
624 
625  $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
626  $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p ";
627  $sql .= " WHERE p.fk_soc = ".((int) $object->id);
628  $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
629  $sql .= " ORDER BY p.date_valid DESC";
630  $sql .= $db->plimit($MAXLIST);
631 
632  $resql = $db->query($sql);
633  if ($resql) {
634  $i = 0;
635  $num = $db->num_rows($resql);
636 
637  if ($num > 0) {
638  print '<div class="div-table-responsive-no-min">';
639  print '<table class="noborder centpercent lastrecordtable">';
640 
641  print '<tr class="liste_titre">';
642  print '<td colspan="3">';
643  print '<table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastSupplierProposals", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
644  print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllPriceRequests").'</span><span class="badge marginleftonlyshort">'.$num.'</span></td>';
645  print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/supplier_proposal/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
646  print '</tr></table>';
647  print '</td></tr>';
648  }
649 
650  while ($i < $num && $i <= $MAXLIST) {
651  $obj = $db->fetch_object($resql);
652 
653  print '<tr class="oddeven">';
654  print '<td class="nowrap">';
655  $proposalstatic->id = $obj->rowid;
656  $proposalstatic->ref = $obj->ref;
657  $proposalstatic->total_ht = $obj->total_ht;
658  $proposalstatic->total_tva = $obj->total_tva;
659  $proposalstatic->total_ttc = $obj->total_ttc;
660  print $proposalstatic->getNomUrl(1);
661  print '</td>';
662  print '<td class="center" width="80">';
663  if ($obj->dc) {
664  print dol_print_date($db->jdate($obj->dc), 'day');
665  } else {
666  print "-";
667  }
668  print '</td>';
669  print '<td class="right" class="nowrap">'.$proposalstatic->LibStatut($obj->fk_statut, 5).'</td>';
670  print '</tr>';
671  $i++;
672  }
673  $db->free($resql);
674 
675  if ($num > 0) {
676  print "</table></div>";
677  }
678  } else {
679  dol_print_error($db);
680  }
681  }
682 
683  /*
684  * Latest supplier orders
685  */
686  $orderstatic = new CommandeFournisseur($db);
687 
688  if ($user->rights->fournisseur->commande->lire) {
689  // TODO move to DAO class
690  // Check if there are supplier orders billable
691  $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
692  $sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
693  $sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
694  $sql2 .= ', '.MAIN_DB_PREFIX.'commande_fournisseur as c';
695  $sql2 .= ' WHERE c.fk_soc = s.rowid';
696  $sql2 .= " AND c.entity IN (".getEntity('commande_fournisseur').")";
697  $sql2 .= ' AND s.rowid = '.((int) $object->id);
698  // Show orders we can bill
699  if (empty($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS)) {
700  $sql2 .= " AND c.fk_statut IN (".$db->sanitize(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php
701  } else {
702  // CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
703  $sql2 .= " AND c.fk_statut IN (".$db->sanitize($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")";
704  }
705  $sql2 .= " AND c.billed = 0";
706  // Find order that are not already invoiced
707  // just need to check received status because we have the billed status now
708  //$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
709  $resql2 = $db->query($sql2);
710  if ($resql2) {
711  $orders2invoice = $db->num_rows($resql2);
712  $db->free($resql2);
713  } else {
714  setEventMessages($db->lasterror(), null, 'errors');
715  }
716 
717  // TODO move to DAO class
718  $sql = "SELECT count(p.rowid) as total";
719  $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
720  $sql .= " WHERE p.fk_soc = ".((int) $object->id);
721  $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
722  $resql = $db->query($sql);
723  if ($resql) {
724  $object_count = $db->fetch_object($resql);
725  $num = $object_count->total;
726  }
727 
728  $sql = "SELECT p.rowid,p.ref, p.date_commande as date, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
729  $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
730  $sql .= " WHERE p.fk_soc = ".((int) $object->id);
731  $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
732  $sql .= " ORDER BY p.date_commande DESC";
733  $sql .= $db->plimit($MAXLIST);
734 
735  $resql = $db->query($sql);
736  if ($resql) {
737  $i = 0;
738 
739  if ($num > 0) {
740  print '<div class="div-table-responsive-no-min">';
741  print '<table class="noborder centpercent lastrecordtable">';
742 
743  print '<tr class="liste_titre">';
744  print '<td colspan="4">';
745  print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans("LastSupplierOrders", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
746  print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllOrders").'</span><span class="badge marginleftonlyshort">'.$num.'</span></td>';
747  print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
748  print '</tr></table>';
749  print '</td></tr>';
750  }
751 
752  while ($i < $num && $i < $MAXLIST) {
753  $obj = $db->fetch_object($resql);
754 
755  $orderstatic->id = $obj->rowid;
756  $orderstatic->ref = $obj->ref;
757  $orderstatic->total_ht = $obj->total_ht;
758  $orderstatic->total_tva = $obj->total_tva;
759  $orderstatic->total_ttc = $obj->total_ttc;
760  $orderstatic->date = $db->jdate($obj->date);
761 
762  print '<tr class="oddeven">';
763  print '<td class="nowraponall">';
764  print $orderstatic->getNomUrl(1);
765  print '</td>';
766  print '<td class="center" width="80">';
767  if ($obj->date) {
768  print dol_print_date($orderstatic->date, 'day');
769  }
770  print '</td>';
771  print '<td class="right nowrap"><span class="amount">'.price($orderstatic->total_ttc).'</span></td>';
772  print '<td class="right" class="nowrap">'.$orderstatic->LibStatut($obj->fk_statut, 5).'</td>';
773  print '</tr>';
774  $i++;
775  }
776  $db->free($resql);
777 
778  if ($num > 0) {
779  print "</table></div>";
780  }
781  } else {
782  dol_print_error($db);
783  }
784  }
785 
786  /*
787  * Latest supplier invoices
788  */
789 
790  $langs->load('bills');
791  $facturestatic = new FactureFournisseur($db);
792 
793  if ($user->rights->fournisseur->facture->lire) {
794  // TODO move to DAO class
795  $sql = 'SELECT f.rowid, f.libelle as label, f.ref, f.ref_supplier, f.fk_statut, f.datef as df, f.total_ht, f.total_tva, f.total_ttc, f.paye,';
796  $sql .= ' SUM(pf.amount) as am';
797  $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
798  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
799  $sql .= ' WHERE f.fk_soc = '.((int) $object->id);
800  $sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
801  $sql .= ' GROUP BY f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef,f.total_ht,f.total_tva,f.total_ttc,f.paye';
802  $sql .= ' ORDER BY f.datef DESC';
803  $resql = $db->query($sql);
804  if ($resql) {
805  $i = 0;
806  $num = $db->num_rows($resql);
807  if ($num > 0) {
808  print '<div class="div-table-responsive-no-min">';
809  print '<table class="noborder centpercent lastrecordtable">';
810 
811  print '<tr class="liste_titre">';
812  print '<td colspan="4">';
813  print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills', ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
814  print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans('AllBills').'</span><span class="badge marginleftonlyshort">'.$num.'</span></td>';
815  print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
816  print '</tr></table>';
817  print '</td></tr>';
818  }
819 
820  while ($i < min($num, $MAXLIST)) {
821  $obj = $db->fetch_object($resql);
822 
823  $facturestatic->id = $obj->rowid;
824  $facturestatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
825  $facturestatic->ref_supplier = $obj->ref_supplier;
826  $facturestatic->libelle = $obj->label; // deprecated
827  $facturestatic->label = $obj->label;
828  $facturestatic->total_ht = $obj->total_ht;
829  $facturestatic->total_tva = $obj->total_tva;
830  $facturestatic->total_ttc = $obj->total_ttc;
831  $facturestatic->date = $db->jdate($obj->df);
832 
833  print '<tr class="oddeven">';
834  print '<td class="tdoverflowmax200">';
835  print '<span class="nowraponall">'.$facturestatic->getNomUrl(1).'</span>';
836  print $obj->ref_supplier ? ' - '.$obj->ref_supplier : '';
837  print ($obj->label ? ' - ' : '').dol_trunc($obj->label, 14);
838  print '</td>';
839  print '<td class="center nowrap">'.dol_print_date($facturestatic->date, 'day').'</td>';
840  print '<td class="right nowrap"><span class="amount">'.price($facturestatic->total_ttc).'</span></td>';
841  print '<td class="right nowrap">';
842  print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $obj->am);
843  print '</td>';
844  print '</tr>';
845  $i++;
846  }
847  $db->free($resql);
848  if ($num > 0) {
849  print '</table></div>';
850  }
851  } else {
852  dol_print_error($db);
853  }
854  }
855 
856  print '</div></div>';
857  print '<div style="clear:both"></div>';
858 
859  print dol_get_fiche_end();
860 
861 
862  /*
863  * Action bar
864  */
865  print '<div class="tabsAction">';
866 
867  $parameters = array();
868  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
869  // modified by hook
870  if (empty($reshook)) {
871  if ($object->status != 1) {
872  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('ThirdPartyIsClosed'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
873  }
874 
875  if (isModEnabled('supplier_proposal') && !empty($user->rights->supplier_proposal->creer)) {
876  $langs->load("supplier_proposal");
877  if ($object->status == 1) {
878  print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&amp;socid='.$object->id, '');
879  } else {
880  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposal'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
881  }
882  }
883 
884  if ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')) {
885  $langs->load("orders");
886  if ($object->status == 1) {
887  print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;token='.newToken().'&amp;socid='.$object->id, '');
888  } else {
889  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierOrderShort'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
890  }
891  }
892 
893  if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
894  if (!empty($orders2invoice) && $orders2invoice > 0) {
895  if ($object->status == 1) {
896  // Company is open
897  print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplier'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&amp;search_billed=0&amp;autoselectall=1', '');
898  } else {
899  print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
900  }
901  } else {
902  print dolGetButtonAction($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
903  }
904  }
905 
906  if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
907  $langs->load("bills");
908  if ($object->status == 1) {
909  print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;socid='.$object->id, '');
910  } else {
911  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddBill'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
912  }
913  }
914 
915  // Add action
916  if (isModEnabled('agenda') && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
917  if ($user->rights->agenda->myactions->create) {
918  print dolGetButtonAction('', $langs->trans('AddAction'), 'default', DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;socid='.$object->id, '');
919  } else {
920  print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddAction'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
921  }
922  }
923  }
924 
925  print '</div>';
926 
927 
928  if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) {
929  print '<br>';
930  // List of contacts
931  show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
932  }
933 
934  if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) {
935  print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
936 
937  // List of todo actions
938  show_actions_todo($conf, $langs, $db, $object);
939 
940  // List of done actions
941  show_actions_done($conf, $langs, $db, $object);
942  }
943 } else {
944  dol_print_error($db);
945 }
946 
947 // End of page
948 llxFooter();
949 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage members of a foundation.
Class to manage predefined suppliers products.
const STATUS_RECEIVED_COMPLETELY
Received completely.
Class to manage contact/addresses.
Class to manage standard extra fields.
Class to manage suppliers invoices.
Class to manage generation of HTML components Only common components must be here.
Class to manage suppliers.
Class to manage products or services.
Class to manage price ask supplier.
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
show_actions_todo($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='')
Show html area with actions to do.
show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
Show html area with actions (done or not, ignore the name of function).
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Definition: company.lib.php:42
$parameters
Actions.
Definition: card.php:79
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.