dolibarr  17.0.4
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' && $user->hasRight('societe', 'creer')) {
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->hasRight('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->hasRight('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->hasRight('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' && $user->hasRight('societe', 'creer')) {
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' && $user->hasRight('societe', 'creer')) {
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  print '<br>';
415 
416  // Lien recap
417  $boxstat .= '<div class="box box-halfright">';
418  $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
419  $boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
420 
421  if (isModEnabled('supplier_proposal')) {
422  // Box proposals
423  $tmp = $object->getOutstandingProposals('supplier');
424  $outstandingOpened = $tmp['opened'];
425  $outstandingTotal = $tmp['total_ht'];
426  $outstandingTotalIncTax = $tmp['total_ttc'];
427  $text = $langs->trans("OverAllSupplierProposals");
428  $link = DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id;
429  $icon = 'bill';
430  if ($link) {
431  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
432  }
433  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
434  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
435  $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
436  $boxstat .= '</div>';
437  if ($link) {
438  $boxstat .= '</a>';
439  }
440  }
441 
442  if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
443  // Box proposals
444  $tmp = $object->getOutstandingOrders('supplier');
445  $outstandingOpened = $tmp['opened'];
446  $outstandingTotal = $tmp['total_ht'];
447  $outstandingTotalIncTax = $tmp['total_ttc'];
448  $text = $langs->trans("OverAllOrders");
449  $link = DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id;
450  $icon = 'bill';
451  if ($link) {
452  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
453  }
454  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
455  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
456  $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
457  $boxstat .= '</div>';
458  if ($link) {
459  $boxstat .= '</a>';
460  }
461  }
462 
463  if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice")) {
464  $warn = '';
465  $tmp = $object->getOutstandingBills('supplier');
466  $outstandingOpened = $tmp['opened'];
467  $outstandingTotal = $tmp['total_ht'];
468  $outstandingTotalIncTax = $tmp['total_ttc'];
469 
470  $text = $langs->trans("OverAllInvoices");
471  $link = DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id;
472  $icon = 'bill';
473  if ($link) {
474  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
475  }
476  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
477  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
478  $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
479  $boxstat .= '</div>';
480  if ($link) {
481  $boxstat .= '</a>';
482  }
483 
484  // Box outstanding bill
485  $text = $langs->trans("CurrentOutstandingBill");
486  $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
487  $icon = 'bill';
488  if ($link) {
489  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
490  }
491  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
492  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
493  $boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
494  $boxstat .= '</div>';
495  if ($link) {
496  $boxstat .= '</a>';
497  }
498 
499  $tmp = $object->getOutstandingBills('supplier', 1);
500  $outstandingOpenedLate = $tmp['opened'];
501  if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
502  $text = $langs->trans("CurrentOutstandingBillLate");
503  $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
504  $icon = 'bill';
505  if ($link) {
506  $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
507  }
508  $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
509  $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
510  $boxstat .= '<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
511  $boxstat .= '</div>';
512  if ($link) {
513  $boxstat .= '</a>';
514  }
515  }
516  }
517 
518 
519  $parameters = array();
520  $reshook = $hookmanager->executeHooks('addMoreBoxStatsSupplier', $parameters, $object, $action);
521  if (empty($reshook)) {
522  $boxstat .= $hookmanager->resPrint;
523  }
524 
525  $boxstat .= '</td></tr>';
526  $boxstat .= '</table>';
527  $boxstat .= '</div>';
528 
529  print $boxstat;
530 
531 
532  $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
533 
534 
535  /*
536  * List of products
537  */
538  if (isModEnabled("product") || isModEnabled("service")) {
539  $langs->load("products");
540  //Query from product/liste.php
541  $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,';
542  $sql .= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice';
543  $sql .= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
544  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
545  $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
546  $sql .= ' AND pfp.fk_soc = '.((int) $object->id);
547  $sql .= $db->order('pfp.tms', 'desc');
548  $sql .= $db->plimit($MAXLIST);
549 
550  $query = $db->query($sql);
551  if (!$query) {
552  dol_print_error($db);
553  }
554 
555  $num = $db->num_rows($query);
556 
557  print '<div class="div-table-responsive-no-min">';
558  print '<table class="noborder centpercent lastrecordtable">';
559  print '<tr class="liste_titre'.(($num == 0) ? ' nobottom' : '').'">';
560  print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td class="right">';
561  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>';
562  print '</a></td></tr>';
563 
564  $return = array();
565  if ($num > 0) {
566  $productstatic = new Product($db);
567 
568  while ($objp = $db->fetch_object($query)) {
569  $productstatic->id = $objp->rowid;
570  $productstatic->ref = $objp->ref;
571  $productstatic->label = $objp->label;
572  $productstatic->type = $objp->fk_product_type;
573  $productstatic->entity = $objp->entity;
574  $productstatic->status = $objp->status;
575  $productstatic->status_buy = $objp->status_buy;
576  $productstatic->status_batch = $objp->status_batch;
577 
578  print '<tr class="oddeven">';
579  print '<td class="nowrap">';
580  print $productstatic->getNomUrl(1);
581  print '</td>';
582  print '<td>';
583  print dol_escape_htmltag($objp->supplier_ref);
584  print '</td>';
585  print '<td class="maxwidthonsmartphone">';
586  print dol_trunc(dol_htmlentities($objp->label), 30);
587  print '</td>';
588  //print '<td class="right" class="nowrap">'.dol_print_date($objp->tms, 'day').'</td>';
589  print '<td class="right">';
590  //print (isset($objp->unitprice) ? price($objp->unitprice) : '');
591  if (isset($objp->price)) {
592  print '<span class="amount">'.price($objp->price).'</span>';
593  if ($objp->quantity > 1) {
594  print ' / ';
595  print $objp->quantity;
596  }
597  }
598  print '</td>';
599  print '</tr>';
600  }
601  }
602 
603  print '</table>';
604  print '</div>';
605  }
606 
607 
608  /*
609  * Latest supplier proposal
610  */
611  $proposalstatic = new SupplierProposal($db);
612 
613  if (!empty($user->rights->supplier_proposal->lire)) {
614  $langs->loadLangs(array("supplier_proposal"));
615 
616  $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
617  $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p ";
618  $sql .= " WHERE p.fk_soc = ".((int) $object->id);
619  $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
620  $sql .= " ORDER BY p.date_valid DESC";
621  $sql .= $db->plimit($MAXLIST);
622 
623  $resql = $db->query($sql);
624  if ($resql) {
625  $i = 0;
626  $num = $db->num_rows($resql);
627 
628  if ($num > 0) {
629  print '<div class="div-table-responsive-no-min">';
630  print '<table class="noborder centpercent lastrecordtable">';
631 
632  print '<tr class="liste_titre">';
633  print '<td colspan="3">';
634  print '<table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastSupplierProposals", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
635  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>';
636  // 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>';
637  print '</tr></table>';
638  print '</td></tr>';
639  }
640 
641  while ($i < $num && $i <= $MAXLIST) {
642  $obj = $db->fetch_object($resql);
643 
644  print '<tr class="oddeven">';
645  print '<td class="nowrap">';
646  $proposalstatic->id = $obj->rowid;
647  $proposalstatic->ref = $obj->ref;
648  $proposalstatic->total_ht = $obj->total_ht;
649  $proposalstatic->total_tva = $obj->total_tva;
650  $proposalstatic->total_ttc = $obj->total_ttc;
651  print $proposalstatic->getNomUrl(1);
652  print '</td>';
653  print '<td class="center" width="80">';
654  if ($obj->dc) {
655  print dol_print_date($db->jdate($obj->dc), 'day');
656  } else {
657  print "-";
658  }
659  print '</td>';
660  print '<td class="right" class="nowrap">'.$proposalstatic->LibStatut($obj->fk_statut, 5).'</td>';
661  print '</tr>';
662  $i++;
663  }
664  $db->free($resql);
665 
666  if ($num > 0) {
667  print "</table></div>";
668  }
669  } else {
670  dol_print_error($db);
671  }
672  }
673 
674  /*
675  * Latest supplier orders
676  */
677  $orderstatic = new CommandeFournisseur($db);
678 
679  if ($user->rights->fournisseur->commande->lire) {
680  // TODO move to DAO class
681  // Check if there are supplier orders billable
682  $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
683  $sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
684  $sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
685  $sql2 .= ', '.MAIN_DB_PREFIX.'commande_fournisseur as c';
686  $sql2 .= ' WHERE c.fk_soc = s.rowid';
687  $sql2 .= " AND c.entity IN (".getEntity('commande_fournisseur').")";
688  $sql2 .= ' AND s.rowid = '.((int) $object->id);
689  // Show orders we can bill
690  if (empty($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS)) {
691  $sql2 .= " AND c.fk_statut IN (".$db->sanitize(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php
692  } else {
693  // CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
694  $sql2 .= " AND c.fk_statut IN (".$db->sanitize($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")";
695  }
696  $sql2 .= " AND c.billed = 0";
697  // Find order that are not already invoiced
698  // just need to check received status because we have the billed status now
699  //$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
700  $resql2 = $db->query($sql2);
701  if ($resql2) {
702  $orders2invoice = $db->num_rows($resql2);
703  $db->free($resql2);
704  } else {
705  setEventMessages($db->lasterror(), null, 'errors');
706  }
707 
708  // TODO move to DAO class
709  $sql = "SELECT count(p.rowid) as total";
710  $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
711  $sql .= " WHERE p.fk_soc = ".((int) $object->id);
712  $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
713  $resql = $db->query($sql);
714  if ($resql) {
715  $object_count = $db->fetch_object($resql);
716  $num = $object_count->total;
717  }
718 
719  $sql = "SELECT p.rowid,p.ref, p.date_commande as date, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
720  $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
721  $sql .= " WHERE p.fk_soc = ".((int) $object->id);
722  $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
723  $sql .= " ORDER BY p.date_commande DESC";
724  $sql .= $db->plimit($MAXLIST);
725 
726  $resql = $db->query($sql);
727  if ($resql) {
728  $i = 0;
729 
730  if ($num > 0) {
731  print '<div class="div-table-responsive-no-min">';
732  print '<table class="noborder centpercent lastrecordtable">';
733 
734  print '<tr class="liste_titre">';
735  print '<td colspan="4">';
736  print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans("LastSupplierOrders", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
737  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>';
738  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>';
739  print '</tr></table>';
740  print '</td></tr>';
741  }
742 
743  while ($i < $num && $i < $MAXLIST) {
744  $obj = $db->fetch_object($resql);
745 
746  $orderstatic->id = $obj->rowid;
747  $orderstatic->ref = $obj->ref;
748  $orderstatic->total_ht = $obj->total_ht;
749  $orderstatic->total_tva = $obj->total_tva;
750  $orderstatic->total_ttc = $obj->total_ttc;
751  $orderstatic->date = $db->jdate($obj->date);
752 
753  print '<tr class="oddeven">';
754  print '<td class="nowraponall">';
755  print $orderstatic->getNomUrl(1);
756  print '</td>';
757  print '<td class="center" width="80">';
758  if ($obj->date) {
759  print dol_print_date($orderstatic->date, 'day');
760  }
761  print '</td>';
762  print '<td class="right nowrap"><span class="amount">'.price($orderstatic->total_ttc).'</span></td>';
763  print '<td class="right" class="nowrap">'.$orderstatic->LibStatut($obj->fk_statut, 5).'</td>';
764  print '</tr>';
765  $i++;
766  }
767  $db->free($resql);
768 
769  if ($num > 0) {
770  print "</table></div>";
771  }
772  } else {
773  dol_print_error($db);
774  }
775  }
776 
777  /*
778  * Latest supplier invoices
779  */
780 
781  $langs->load('bills');
782  $facturestatic = new FactureFournisseur($db);
783 
784  if ($user->rights->fournisseur->facture->lire) {
785  // TODO move to DAO class
786  $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,';
787  $sql .= ' SUM(pf.amount) as am';
788  $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
789  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
790  $sql .= ' WHERE f.fk_soc = '.((int) $object->id);
791  $sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
792  $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';
793  $sql .= ' ORDER BY f.datef DESC';
794  $resql = $db->query($sql);
795  if ($resql) {
796  $i = 0;
797  $num = $db->num_rows($resql);
798  if ($num > 0) {
799  print '<div class="div-table-responsive-no-min">';
800  print '<table class="noborder centpercent lastrecordtable">';
801 
802  print '<tr class="liste_titre">';
803  print '<td colspan="4">';
804  print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills', ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
805  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>';
806  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>';
807  print '</tr></table>';
808  print '</td></tr>';
809  }
810 
811  while ($i < min($num, $MAXLIST)) {
812  $obj = $db->fetch_object($resql);
813 
814  $facturestatic->id = $obj->rowid;
815  $facturestatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
816  $facturestatic->ref_supplier = $obj->ref_supplier;
817  $facturestatic->libelle = $obj->label; // deprecated
818  $facturestatic->label = $obj->label;
819  $facturestatic->total_ht = $obj->total_ht;
820  $facturestatic->total_tva = $obj->total_tva;
821  $facturestatic->total_ttc = $obj->total_ttc;
822  $facturestatic->date = $db->jdate($obj->df);
823 
824  print '<tr class="oddeven">';
825  print '<td class="tdoverflowmax200">';
826  print '<span class="nowraponall">'.$facturestatic->getNomUrl(1).'</span>';
827  print $obj->ref_supplier ? ' - '.$obj->ref_supplier : '';
828  print ($obj->label ? ' - ' : '').dol_trunc($obj->label, 14);
829  print '</td>';
830  print '<td class="center nowrap">'.dol_print_date($facturestatic->date, 'day').'</td>';
831  print '<td class="right nowrap"><span class="amount">'.price($facturestatic->total_ttc).'</span></td>';
832  print '<td class="right nowrap">';
833  print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $obj->am);
834  print '</td>';
835  print '</tr>';
836  $i++;
837  }
838  $db->free($resql);
839  if ($num > 0) {
840  print '</table></div>';
841  }
842  } else {
843  dol_print_error($db);
844  }
845  }
846 
847  print '</div></div>';
848  print '<div style="clear:both"></div>';
849 
850  print dol_get_fiche_end();
851 
852 
853  /*
854  * Action bar
855  */
856  print '<div class="tabsAction">';
857 
858  $parameters = array();
859  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
860  // modified by hook
861  if (empty($reshook)) {
862  if ($object->status != 1) {
863  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('ThirdPartyIsClosed'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
864  }
865 
866  if (isModEnabled('supplier_proposal') && !empty($user->rights->supplier_proposal->creer)) {
867  $langs->load("supplier_proposal");
868  if ($object->status == 1) {
869  print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&amp;socid='.$object->id, '');
870  } else {
871  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposal'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
872  }
873  }
874 
875  if ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')) {
876  $langs->load("orders");
877  if ($object->status == 1) {
878  print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;token='.newToken().'&amp;socid='.$object->id, '');
879  } else {
880  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierOrderShort'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
881  }
882  }
883 
884  if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
885  if (!empty($orders2invoice) && $orders2invoice > 0) {
886  if ($object->status == 1) {
887  // Company is open
888  print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplier'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&amp;search_billed=0&amp;autoselectall=1', '');
889  } else {
890  print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
891  }
892  } else {
893  print dolGetButtonAction($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
894  }
895  }
896 
897  if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
898  $langs->load("bills");
899  if ($object->status == 1) {
900  print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;socid='.$object->id, '');
901  } else {
902  print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddBill'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
903  }
904  }
905 
906  // Add action
907  if (isModEnabled('agenda') && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
908  if ($user->rights->agenda->myactions->create) {
909  print dolGetButtonAction('', $langs->trans('AddAction'), 'default', DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;socid='.$object->id, '');
910  } else {
911  print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddAction'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
912  }
913  }
914  }
915 
916  print '</div>';
917 
918 
919  if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) {
920  print '<br>';
921  // List of contacts
922  show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
923  }
924 
925  if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) {
926  print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
927 
928  // List of todo actions
929  show_actions_todo($conf, $langs, $db, $object);
930 
931  // List of done actions
932  show_actions_done($conf, $langs, $db, $object);
933  }
934 } else {
935  dol_print_error($db);
936 }
937 
938 // End of page
939 llxFooter();
940 $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.