dolibarr 19.0.3
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('adherent')) {
41 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
42}
43if (isModEnabled('categorie')) {
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 = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
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(GETPOST('cond_reglement_supplier_id', 'int'));
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(GETPOST('mode_reglement_supplier_id', 'int'));
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(GETPOST('fk_account', 'int'));
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/', $conf->global->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 */
213 $head = societe_prepare_head($object);
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>';
238 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
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 print '<tr>';
279 print '<td class="titlefield">';
280 print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc'));
281 print '</td><td>';
282 print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').' disabled>';
283 print '</td>';
284 print '</tr>';
285
286 // TVA Intra
287 print '<tr><td class="nowrap">';
288 //print $langs->trans('VATIntra').'</td><td>';
289 $vattoshow = ($object->tva_intra ? showValueWithClipboardCPButton(dol_escape_htmltag($object->tva_intra)) : '');
290 print $form->editfieldkey("VATIntra", 'tva_intra', $object->tva_intra, $object, $user->hasRight('societe', 'creer'));
291 print '</td><td>';
292 print $form->editfieldval("VATIntra", 'tva_intra', $vattoshow, $object, $user->hasRight('societe', 'creer'), 'string', $object->tva_intra, null, null, '', 1, '', 'id', 'auto', array('valuealreadyhtmlescaped'=>1));
293 print '</td></tr>';
294
295 // Default terms of the settlement
296 $langs->load('bills');
297 $form = new Form($db);
298 print '<tr><td>';
299 print '<table width="100%" class="nobordernopadding"><tr><td>';
300 print $langs->trans('PaymentConditions');
301 print '<td>';
302 if (($action != 'editconditions') && $user->hasRight('societe', 'creer')) {
303 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>';
304 }
305 print '</tr></table>';
306 print '</td><td>';
307 if ($action == 'editconditions') {
308 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', 1);
309 } else {
310 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'none');
311 }
312 print "</td>";
313 print '</tr>';
314
315 // Default payment mode
316 print '<tr><td class="nowrap">';
317 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
318 print $langs->trans('PaymentMode');
319 print '<td>';
320 if (($action != 'editmode') && $user->hasRight('societe', 'creer')) {
321 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>';
322 }
323 print '</tr></table>';
324 print '</td><td>';
325 if ($action == 'editmode') {
326 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1);
327 } else {
328 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'none');
329 }
330 print "</td>";
331 print '</tr>';
332
333 if (isModEnabled("banque")) {
334 // Default bank account for payments
335 print '<tr><td class="nowrap">';
336 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
337 print $langs->trans('PaymentBankAccount');
338 print '<td>';
339 if (($action != 'editbankaccount') && $user->hasRight('societe', 'creer')) {
340 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>';
341 }
342 print '</tr></table>';
343 print '</td><td>';
344 if ($action == 'editbankaccount') {
345 $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1);
346 } else {
347 $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none');
348 }
349 print "</td>";
350 print '</tr>';
351 }
352
353 // Relative discounts (Discounts-Drawbacks-Rebates)
354 print '<tr><td class="nowrap">';
355 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
356 print $langs->trans("CustomerRelativeDiscountShort");
357 print '<td><td class="right">';
358 if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
359 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>';
360 }
361 print '</td></tr></table>';
362 print '</td><td>'.($object->remise_supplier_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_supplier_percent.'%</a>' : '').'</td>';
363 print '</tr>';
364
365 // Absolute discounts (Discounts-Drawbacks-Rebates)
366 print '<tr><td class="nowrap">';
367 print '<table width="100%" class="nobordernopadding">';
368 print '<tr><td class="nowrap">';
369 print $langs->trans("CustomerAbsoluteDiscountShort");
370 print '<td><td class="right">';
371 if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
372 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>';
373 }
374 print '</td></tr></table>';
375 print '</td>';
376 print '<td>';
377 $amount_discount = $object->getAvailableDiscounts('', '', 0, 1);
378 if ($amount_discount < 0) {
379 dol_print_error($db, $object->error);
380 }
381 if ($amount_discount > 0) {
382 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>';
383 }
384 //else print $langs->trans("DiscountNone");
385 print '</td>';
386 print '</tr>';
387
388 if (isModEnabled("supplier_order") && getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT')) {
389 print '<tr class="nowrap">';
390 print '<td>';
391 print $form->editfieldkey("OrderMinAmount", 'supplier_order_min_amount', $object->supplier_order_min_amount, $object, $user->hasRight("societe", "creer"));
392 print '</td><td>';
393 $limit_field_type = (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE')) ? 'numeric' : 'amount';
394 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) : ''));
395 print '</td>';
396 print '</tr>';
397 }
398
399 // Categories
400 if (isModEnabled('categorie')) {
401 $langs->load("categories");
402 print '<tr><td>'.$langs->trans("SuppliersCategoriesShort").'</td>';
403 print '<td>';
404 print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);
405 print "</td></tr>";
406 }
407
408 // Other attributes
409 $parameters = array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
410 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
411
412 // Module Adherent
413 if (isModEnabled('adherent')) {
414 $langs->load("members");
415 $langs->load("users");
416 print '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
417 print '<td>';
418 $adh = new Adherent($db);
419 $result = $adh->fetch('', '', $object->id);
420 if ($result > 0) {
421 $adh->ref = $adh->getFullName($langs);
422 print $adh->getNomUrl(1);
423 } else {
424 print $langs->trans("ThirdpartyNotLinkedToMember");
425 }
426 print '</td>';
427 print "</tr>\n";
428 }
429
430 print '</table>';
431
432
433 print '</div><div class="fichehalfright">';
434
435 $boxstat = '';
436
437 // Nbre max d'elements des petites listes
438 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
439
440 print '<div class="underbanner underbanner-before-box clearboth"></div>';
441 print '<br>';
442
443 // Lien recap
444 $boxstat .= '<div class="box box-halfright">';
445 $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
446 $boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
447
448 if (isModEnabled('supplier_proposal')) {
449 // Box proposals
450 $tmp = $object->getOutstandingProposals('supplier');
451 $outstandingOpened = $tmp['opened'];
452 $outstandingTotal = $tmp['total_ht'];
453 $outstandingTotalIncTax = $tmp['total_ttc'];
454 $text = $langs->trans("OverAllSupplierProposals");
455 $link = DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id;
456 $icon = 'bill';
457 if ($link) {
458 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
459 }
460 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
461 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
462 $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
463 $boxstat .= '</div>';
464 if ($link) {
465 $boxstat .= '</a>';
466 }
467 }
468
469 if (isModEnabled("supplier_order")) {
470 // Box proposals
471 $tmp = $object->getOutstandingOrders('supplier');
472 $outstandingOpened = $tmp['opened'];
473 $outstandingTotal = $tmp['total_ht'];
474 $outstandingTotalIncTax = $tmp['total_ttc'];
475 $text = $langs->trans("OverAllOrders");
476 $link = DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id;
477 $icon = 'bill';
478 if ($link) {
479 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
480 }
481 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
482 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
483 $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
484 $boxstat .= '</div>';
485 if ($link) {
486 $boxstat .= '</a>';
487 }
488 }
489
490 if (isModEnabled("supplier_invoice") && ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'read'))) {
491 $warn = '';
492 $tmp = $object->getOutstandingBills('supplier');
493 $outstandingOpened = $tmp['opened'];
494 $outstandingTotal = $tmp['total_ht'];
495 $outstandingTotalIncTax = $tmp['total_ttc'];
496
497 $text = $langs->trans("OverAllInvoices");
498 $link = DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id;
499 $icon = 'bill';
500 if ($link) {
501 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
502 }
503 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
504 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
505 $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
506 $boxstat .= '</div>';
507 if ($link) {
508 $boxstat .= '</a>';
509 }
510
511 // Box outstanding bill
512 $text = $langs->trans("CurrentOutstandingBill");
513 $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
514 $icon = 'bill';
515 if ($link) {
516 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
517 }
518 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
519 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
520 $boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
521 $boxstat .= '</div>';
522 if ($link) {
523 $boxstat .= '</a>';
524 }
525
526 $tmp = $object->getOutstandingBills('supplier', 1);
527 $outstandingOpenedLate = $tmp['opened'];
528 if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
529 $text = $langs->trans("CurrentOutstandingBillLate");
530 $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
531 $icon = 'bill';
532 if ($link) {
533 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
534 }
535 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
536 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
537 $boxstat .= '<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
538 $boxstat .= '</div>';
539 if ($link) {
540 $boxstat .= '</a>';
541 }
542 }
543 }
544
545
546 $parameters = array();
547 $reshook = $hookmanager->executeHooks('addMoreBoxStatsSupplier', $parameters, $object, $action);
548 if (empty($reshook)) {
549 $boxstat .= $hookmanager->resPrint;
550 }
551
552 $boxstat .= '</td></tr>';
553 $boxstat .= '</table>';
554 $boxstat .= '</div>';
555
556 print $boxstat;
557
558
559 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
560
561
562 /*
563 * List of products
564 */
565 if (isModEnabled("product") || isModEnabled("service")) {
566 $langs->load("products");
567 //Query from product/liste.php
568 $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,';
569 $sql .= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice';
570 $sql .= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
571 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
572 $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
573 $sql .= ' AND pfp.fk_soc = '.((int) $object->id);
574 $sql .= $db->order('pfp.tms', 'desc');
575 $sql .= $db->plimit($MAXLIST);
576
577 $query = $db->query($sql);
578 if (!$query) {
579 dol_print_error($db);
580 }
581
582 $num = $db->num_rows($query);
583
584 print '<div class="div-table-responsive-no-min">';
585 print '<table class="noborder centpercent lastrecordtable">';
586 print '<tr class="liste_titre'.(($num == 0) ? ' nobottom' : '').'">';
587 print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td class="right">';
588 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>';
589 print '</a></td></tr>';
590
591 $return = array();
592 if ($num > 0) {
593 $productstatic = new Product($db);
594
595 while ($objp = $db->fetch_object($query)) {
596 $productstatic->id = $objp->rowid;
597 $productstatic->ref = $objp->ref;
598 $productstatic->label = $objp->label;
599 $productstatic->type = $objp->fk_product_type;
600 $productstatic->entity = $objp->entity;
601 $productstatic->status = $objp->status;
602 $productstatic->status_buy = $objp->status_buy;
603 $productstatic->status_batch = $objp->status_batch;
604
605 print '<tr class="oddeven">';
606 print '<td class="nowrap">';
607 print $productstatic->getNomUrl(1);
608 print '</td>';
609 print '<td>';
610 print dol_escape_htmltag($objp->supplier_ref);
611 print '</td>';
612 print '<td class="maxwidthonsmartphone">';
613 print dol_trunc(dol_htmlentities($objp->label), 30);
614 print '</td>';
615 //print '<td class="right" class="nowrap">'.dol_print_date($objp->tms, 'day').'</td>';
616 print '<td class="right">';
617 //print (isset($objp->unitprice) ? price($objp->unitprice) : '');
618 if (isset($objp->price)) {
619 print '<span class="amount">'.price($objp->price).'</span>';
620 if ($objp->quantity > 1) {
621 print ' / ';
622 print $objp->quantity;
623 }
624 }
625 print '</td>';
626 print '</tr>';
627 }
628 }
629
630 print '</table>';
631 print '</div>';
632 }
633
634
635 /*
636 * Latest supplier proposal
637 */
638 $proposalstatic = new SupplierProposal($db);
639
640 if ($user->hasRight("supplier_proposal", "lire")) {
641 $langs->loadLangs(array("supplier_proposal"));
642
643 $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
644 $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p ";
645 $sql .= " WHERE p.fk_soc = ".((int) $object->id);
646 $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
647 $sql .= " ORDER BY p.date_valid DESC";
648 $sql .= $db->plimit($MAXLIST);
649
650 $resql = $db->query($sql);
651 if ($resql) {
652 $i = 0;
653 $num = $db->num_rows($resql);
654
655 if ($num > 0) {
656 print '<div class="div-table-responsive-no-min">';
657 print '<table class="noborder centpercent lastrecordtable">';
658
659 print '<tr class="liste_titre">';
660 print '<td colspan="3">';
661 print '<table class="nobordernopadding centpercent"><tr><td>'.$langs->trans("LastSupplierProposals", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
662 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>';
663 // 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>';
664 print '</tr></table>';
665 print '</td></tr>';
666 }
667
668 while ($i < $num && $i <= $MAXLIST) {
669 $obj = $db->fetch_object($resql);
670
671 print '<tr class="oddeven">';
672 print '<td class="nowrap">';
673 $proposalstatic->id = $obj->rowid;
674 $proposalstatic->ref = $obj->ref;
675 $proposalstatic->total_ht = $obj->total_ht;
676 $proposalstatic->total_tva = $obj->total_tva;
677 $proposalstatic->total_ttc = $obj->total_ttc;
678 print $proposalstatic->getNomUrl(1);
679 print '</td>';
680 print '<td class="center" width="80">';
681 if ($obj->dc) {
682 print dol_print_date($db->jdate($obj->dc), 'day');
683 } else {
684 print "-";
685 }
686 print '</td>';
687 print '<td class="right" class="nowrap">'.$proposalstatic->LibStatut($obj->fk_statut, 5).'</td>';
688 print '</tr>';
689 $i++;
690 }
691 $db->free($resql);
692
693 if ($num > 0) {
694 print "</table></div>";
695 }
696 } else {
697 dol_print_error($db);
698 }
699 }
700
701 /*
702 * Latest supplier orders
703 */
704 $orderstatic = new CommandeFournisseur($db);
705
706 if ($user->hasRight("fournisseur", "commande", "lire")) {
707 // TODO move to DAO class
708 // Check if there are supplier orders billable
709 $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
710 $sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
711 $sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
712 $sql2 .= ', '.MAIN_DB_PREFIX.'commande_fournisseur as c';
713 $sql2 .= ' WHERE c.fk_soc = s.rowid';
714 $sql2 .= " AND c.entity IN (".getEntity('commande_fournisseur').")";
715 $sql2 .= ' AND s.rowid = '.((int) $object->id);
716 // Show orders we can bill
717 if (!getDolGlobalString('SUPPLIER_ORDER_TO_INVOICE_STATUS')) {
718 $sql2 .= " AND c.fk_statut IN (".$db->sanitize(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php
719 } else {
720 // CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
721 $sql2 .= " AND c.fk_statut IN (".$db->sanitize($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")";
722 }
723 $sql2 .= " AND c.billed = 0";
724 // Find order that are not already invoiced
725 // just need to check received status because we have the billed status now
726 //$sql2 .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
727 $resql2 = $db->query($sql2);
728 if ($resql2) {
729 $orders2invoice = $db->num_rows($resql2);
730 $db->free($resql2);
731 } else {
732 setEventMessages($db->lasterror(), null, 'errors');
733 }
734
735 // TODO move to DAO class
736 $sql = "SELECT count(p.rowid) as total";
737 $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
738 $sql .= " WHERE p.fk_soc = ".((int) $object->id);
739 $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
740 $resql = $db->query($sql);
741 if ($resql) {
742 $object_count = $db->fetch_object($resql);
743 $num = $object_count->total;
744 }
745
746 $sql = "SELECT p.rowid,p.ref, p.date_commande as date, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
747 $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p";
748 $sql .= " WHERE p.fk_soc = ".((int) $object->id);
749 $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")";
750 $sql .= " ORDER BY p.date_commande DESC";
751 $sql .= $db->plimit($MAXLIST);
752
753 $resql = $db->query($sql);
754 if ($resql) {
755 $i = 0;
756
757 if ($num > 0) {
758 print '<div class="div-table-responsive-no-min">';
759 print '<table class="noborder centpercent lastrecordtable">';
760
761 print '<tr class="liste_titre">';
762 print '<td colspan="4">';
763 print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans("LastSupplierOrders", ($num < $MAXLIST ? "" : $MAXLIST)).'</td>';
764 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>';
765 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>';
766 print '</tr></table>';
767 print '</td></tr>';
768 }
769
770 while ($i < $num && $i < $MAXLIST) {
771 $obj = $db->fetch_object($resql);
772
773 $orderstatic->id = $obj->rowid;
774 $orderstatic->ref = $obj->ref;
775 $orderstatic->total_ht = $obj->total_ht;
776 $orderstatic->total_tva = $obj->total_tva;
777 $orderstatic->total_ttc = $obj->total_ttc;
778 $orderstatic->date = $db->jdate($obj->date);
779
780 print '<tr class="oddeven">';
781 print '<td class="nowraponall">';
782 print $orderstatic->getNomUrl(1);
783 print '</td>';
784 print '<td class="center" width="80">';
785 if ($obj->date) {
786 print dol_print_date($orderstatic->date, 'day');
787 }
788 print '</td>';
789 print '<td class="right nowrap"><span class="amount">'.price($orderstatic->total_ttc).'</span></td>';
790 print '<td class="right" class="nowrap">'.$orderstatic->LibStatut($obj->fk_statut, 5).'</td>';
791 print '</tr>';
792 $i++;
793 }
794 $db->free($resql);
795
796 if ($num > 0) {
797 print "</table></div>";
798 }
799 } else {
800 dol_print_error($db);
801 }
802 }
803
804 /*
805 * Latest supplier invoices
806 */
807
808 $langs->load('bills');
809 $facturestatic = new FactureFournisseur($db);
810
811 if ($user->hasRight('fournisseur', 'facture', 'lire')) {
812 // TODO move to DAO class
813 $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,';
814 $sql .= ' SUM(pf.amount) as am';
815 $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
816 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn';
817 $sql .= ' WHERE f.fk_soc = '.((int) $object->id);
818 $sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
819 $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';
820 $sql .= ' ORDER BY f.datef DESC';
821 $resql = $db->query($sql);
822 if ($resql) {
823 $i = 0;
824 $num = $db->num_rows($resql);
825 if ($num > 0) {
826 print '<div class="div-table-responsive-no-min">';
827 print '<table class="noborder centpercent lastrecordtable">';
828
829 print '<tr class="liste_titre">';
830 print '<td colspan="4">';
831 print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills', ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
832 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>';
833 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>';
834 print '</tr></table>';
835 print '</td></tr>';
836 }
837
838 while ($i < min($num, $MAXLIST)) {
839 $obj = $db->fetch_object($resql);
840
841 $facturestatic->id = $obj->rowid;
842 $facturestatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
843 $facturestatic->ref_supplier = $obj->ref_supplier;
844 $facturestatic->libelle = $obj->label; // deprecated
845 $facturestatic->label = $obj->label;
846 $facturestatic->total_ht = $obj->total_ht;
847 $facturestatic->total_tva = $obj->total_tva;
848 $facturestatic->total_ttc = $obj->total_ttc;
849 $facturestatic->date = $db->jdate($obj->df);
850
851 print '<tr class="oddeven">';
852 print '<td class="tdoverflowmax200">';
853 print '<span class="nowraponall">'.$facturestatic->getNomUrl(1).'</span>';
854 print $obj->ref_supplier ? ' - '.$obj->ref_supplier : '';
855 print($obj->label ? ' - ' : '').dol_trunc($obj->label, 14);
856 print '</td>';
857 print '<td class="center nowrap">'.dol_print_date($facturestatic->date, 'day').'</td>';
858 print '<td class="right nowrap"><span class="amount">'.price($facturestatic->total_ttc).'</span></td>';
859 print '<td class="right nowrap">';
860 print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $obj->am);
861 print '</td>';
862 print '</tr>';
863 $i++;
864 }
865 $db->free($resql);
866 if ($num > 0) {
867 print '</table></div>';
868 }
869 } else {
870 dol_print_error($db);
871 }
872 }
873
874 // Allow external modules to add their own shortlist of recent objects
875 $parameters = array();
876 $reshook = $hookmanager->executeHooks('addMoreRecentObjects', $parameters, $object, $action);
877 if ($reshook < 0) {
878 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
879 } else {
880 print $hookmanager->resPrint;
881 }
882
883 print '</div></div>';
884 print '<div class="clearboth"></div>';
885
886 print dol_get_fiche_end();
887
888
889 /*
890 * Action bar
891 */
892 print '<div class="tabsAction">';
893
894 $parameters = array();
895 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
896 // modified by hook
897 if (empty($reshook)) {
898 if ($object->status != 1) {
899 print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('ThirdPartyIsClosed'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
900 }
901
902 if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "creer")) {
903 $langs->load("supplier_proposal");
904 if ($object->status == 1) {
905 print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&amp;socid='.$object->id, '');
906 } else {
907 print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposal'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
908 }
909 }
910
911 if ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')) {
912 $langs->load("orders");
913 if ($object->status == 1) {
914 print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;token='.newToken().'&amp;socid='.$object->id, '');
915 } else {
916 print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierOrderShort'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
917 }
918 }
919
920 if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
921 if (!empty($orders2invoice) && $orders2invoice > 0) {
922 if ($object->status == 1) {
923 // Company is open
924 print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplier'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&amp;search_billed=0&amp;autoselectall=1', '');
925 } else {
926 print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
927 }
928 } else {
929 print dolGetButtonAction($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
930 }
931 }
932
933 if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
934 $langs->load("bills");
935 if ($object->status == 1) {
936 print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;socid='.$object->id, '');
937 } else {
938 print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddBill'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
939 }
940 }
941
942 // Add action
943 if (isModEnabled('agenda') && getDolGlobalString('MAIN_REPEATTASKONEACHTAB') && $object->status == 1) {
944 if ($user->hasRight("agenda", "myactions", "create")) {
945 print dolGetButtonAction('', $langs->trans('AddAction'), 'default', DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;socid='.$object->id, '');
946 } else {
947 print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddAction'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
948 }
949 }
950 }
951
952 print '</div>';
953
954
955 if (getDolGlobalString('MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD')) {
956 print '<br>';
957 // List of contacts
958 show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
959 }
960
961 if (getDolGlobalString('MAIN_REPEATTASKONEACHTAB')) {
962 print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
963
964 // List of todo actions
965 show_actions_todo($conf, $langs, $db, $object);
966
967 // List of done actions
968 show_actions_done($conf, $langs, $db, $object);
969 }
970} else {
971 dol_print_error($db);
972}
973
974// End of page
975llxFooter();
976$db->close();
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 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.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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_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.
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)
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_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 editer/modifier 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.
Contact()
Old copy.
Definition index.php:572