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