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