dolibarr 22.0.5
card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
5 * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
6 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
7 * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
8 * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
10 * Copyright (C) 2021-2025 Frédéric France <frederic.france@free.fr>
11 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
12 * Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
13 * Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
14 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 */
29
36// Load Dolibarr environment
37require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
42require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
43require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
44require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
47if (isModEnabled('invoice')) {
48 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
49 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
50}
51if (isModEnabled("propal")) {
52 require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
53}
54if (isModEnabled('order')) {
55 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
56}
57if (isModEnabled("shipping")) {
58 require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
59}
60if (isModEnabled('contract')) {
61 require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
62}
63if (isModEnabled('member')) {
64 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
65}
66if (isModEnabled('intervention')) {
67 require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
68}
69if (isModEnabled('accounting')) {
70 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
71 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
72}
73
83// Load translation files required by the page
84$langs->loadLangs(array('companies', 'banks', 'commercial'));
85
86if (isModEnabled('contract')) {
87 $langs->load("contracts");
88}
89if (isModEnabled('order')) {
90 $langs->load("orders");
91}
92if (isModEnabled("shipping")) {
93 $langs->load("sendings");
94}
95if (isModEnabled('invoice')) {
96 $langs->load("bills");
97}
98if (isModEnabled('project')) {
99 $langs->load("projects");
100}
101if (isModEnabled('intervention')) {
102 $langs->load("interventions");
103}
104if (isModEnabled('notification')) {
105 $langs->load("mails");
106}
107
108$action = GETPOST('action', 'aZ09');
109
110$id = (GETPOSTINT('socid') ? GETPOSTINT('socid') : GETPOSTINT('id'));
111
112$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
113$sortfield = GETPOST('sortfield', 'aZ09comma');
114$sortorder = GETPOST('sortorder', 'aZ09comma');
115$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
116if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
117 // If $page is not defined, or '' or -1 or if we click on clear filters
118 $page = 0;
119}
120$offset = $limit * $page;
121$pageprev = $page - 1;
122$pagenext = $page + 1;
123if (!$sortorder) {
124 $sortorder = "ASC";
125}
126if (!$sortfield) {
127 $sortfield = "nom";
128}
129$cancel = GETPOST('cancel', 'alpha');
130
131$object = new Client($db);
132$extrafields = new ExtraFields($db);
133$formfile = new FormFile($db);
134
135// fetch optionals attributes and labels
136$extrafields->fetch_name_optionals_label($object->table_element);
137
138// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
139$hookmanager->initHooks(array('thirdpartycomm', 'globalcard'));
140
141$now = dol_now();
142
143if ($id > 0 && empty($object->id)) {
144 // Load data of third party
145 $res = $object->fetch($id);
146 if ($object->id < 0) {
147 dol_print_error($db, $object->error, $object->errors);
148 }
149}
150if ($object->id > 0) {
151 if (!($object->client > 0) || !$user->hasRight('societe', 'lire')) {
153 }
154}
155
156// Security check
157if ($user->socid > 0) {
158 $id = $user->socid;
159}
160$result = restrictedArea($user, 'societe', $object->id, '&societe', '', 'fk_soc', 'rowid', 0);
161
162$permissiontoadd = $user->hasRight('societe', 'creer');
163$permissiontoeditextra = $permissiontoadd;
164if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
165 // For action 'update_extras', is there a specific permission set for the attribute to update
166 $permissiontoeditextra = dol_eval((string) $extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')]);
167}
168
169
170/*
171 * Actions
172 */
173$error = 0;
174
175$parameters = array('id' => $id, 'socid' => $id);
176$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
177if ($reshook < 0) {
178 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
179}
180
181if (empty($reshook)) {
182 if ($cancel) {
183 $action = "";
184 }
185
186 // set accountancy code
187 if ($action == 'setcustomeraccountancycodegeneral' && $permissiontoadd) {
188 $result = $object->fetch($id);
189 $object->accountancy_code_customer_general = GETPOST("customeraccountancycodegeneral");
190 $result = $object->update($object->id, $user, 1, 1, 0);
191 if ($result < 0) {
192 setEventMessages($object->error, $object->errors, 'errors');
193 }
194 }
195
196 // Set accountancy code
197 if ($action == 'setcustomeraccountancycode' && $permissiontoadd) {
198 $result = $object->fetch($id);
199 $object->code_compta_client = GETPOST("customeraccountancycode");
200 $object->code_compta = $object->code_compta_client; // For Backward compatibility
201 $result = $object->update($object->id, $user, 1, 1, 0);
202 if ($result < 0) {
203 setEventMessages($object->error, $object->errors, 'errors');
204 $action = 'editcustomeraccountancycode';
205 }
206 }
207
208 // Payment terms of the settlement
209 if ($action == 'setconditions' && $permissiontoadd) {
210 $object->fetch($id);
211 $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTINT('cond_reglement_id_deposit_percent'));
212 if ($result < 0) {
213 setEventMessages($object->error, $object->errors, 'errors');
214 }
215 }
216
217 // Payment mode
218 if ($action == 'setmode' && $permissiontoadd) {
219 $object->fetch($id);
220 $result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id'));
221 if ($result < 0) {
222 setEventMessages($object->error, $object->errors, 'errors');
223 }
224 }
225
226 // Transport mode
227 if ($action == 'settransportmode' && $permissiontoadd) {
228 $object->fetch($id);
229 $result = $object->setTransportMode(GETPOSTINT('transport_mode_id'));
230 if ($result < 0) {
231 setEventMessages($object->error, $object->errors, 'errors');
232 }
233 }
234
235 // Bank account
236 if ($action == 'setbankaccount' && $permissiontoadd) {
237 $object->fetch($id);
238 $result = $object->setBankAccount(GETPOSTINT('fk_account'));
239 if ($result < 0) {
240 setEventMessages($object->error, $object->errors, 'errors');
241 }
242 }
243
244 // customer preferred shipping method
245 if ($action == 'setshippingmethod' && $permissiontoadd) {
246 $object->fetch($id);
247 $result = $object->setShippingMethod(GETPOSTINT('shipping_method_id'));
248 if ($result < 0) {
249 setEventMessages($object->error, $object->errors, 'errors');
250 }
251 }
252
253 // assujetissement a la TVA
254 if ($action == 'setassujtva' && $permissiontoadd) {
255 $object->fetch($id);
256 $object->tva_assuj = GETPOSTINT('assujtva_value');
257 $result = $object->update($object->id, $user);
258 if ($result < 0) {
259 setEventMessages($object->error, $object->errors, 'errors');
260 }
261 }
262
263 // set prospect level
264 if ($action == 'setprospectlevel' && $permissiontoadd) {
265 $object->fetch($id);
266 $object->fk_prospectlevel = GETPOST('prospect_level_id', 'alpha');
267 $result = $object->update($object->id, $user);
268 if ($result < 0) {
269 setEventMessages($object->error, $object->errors, 'errors');
270 }
271 }
272
273 // set communication status
274 if ($action == 'setstcomm' && $permissiontoadd) {
275 $object->fetch($id);
276 $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm');
277 $result = $object->update($object->id, $user);
278 if ($result < 0) {
279 setEventMessages($object->error, $object->errors, 'errors');
280 } else {
281 $result = $object->fetch($object->id);
282 }
283 }
284
285 // update outstandng limit
286 if ($action == 'setoutstanding_limit' && $permissiontoadd) {
287 $object->fetch($id);
288 $object->outstanding_limit = GETPOST('outstanding_limit');
289 $result = $object->update($object->id, $user);
290 if ($result < 0) {
291 setEventMessages($object->error, $object->errors, 'errors');
292 }
293 }
294
295 // update order min amount
296 if ($action == 'setorder_min_amount' && $permissiontoadd) {
297 $object->fetch($id);
298 $object->order_min_amount = price2num(GETPOST('order_min_amount', 'alpha'));
299 $result = $object->update($object->id, $user);
300 if ($result < 0) {
301 setEventMessages($object->error, $object->errors, 'errors');
302 }
303 }
304
305 // Set sales representatives
306 if ($action == 'set_salesrepresentatives' && $permissiontoadd) {
307 $object->fetch($id);
308 $result = $object->setSalesRep(GETPOST('commercial', 'array'));
309 }
310
311 if ($action == 'update_extras' && $permissiontoeditextra) {
312 $object->fetch($id);
313
314 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
315
316 $attribute_name = GETPOST('attribute', 'aZ09');
317
318 // Fill array 'array_options' with data from update form
319 $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
320 if ($ret < 0) {
321 $error++;
322 }
323
324 if (!$error) {
325 $result = $object->updateExtraField($attribute_name, 'COMPANY_MODIFY');
326 if ($result < 0) {
327 setEventMessages($object->error, $object->errors, 'errors');
328 $error++;
329 }
330 }
331
332 if ($error) {
333 $action = 'edit_extras';
334 }
335 }
336
337 // warehouse
338 if ($action == 'setwarehouse' && $permissiontoadd) {
339 $result = $object->setWarehouse(GETPOSTINT('fk_warehouse'));
340 }
341}
342
343
344/*
345 * View
346 */
347
348$contactstatic = new Contact($db);
349$userstatic = new User($db);
350$form = new Form($db);
351$formcompany = new FormCompany($db);
352$project = new Project($db);
353
354$title = $langs->trans("ThirdParty")." - ".$langs->trans('Customer');
355if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
356 $title = $object->name." - ".$langs->trans('Customer');
357}
358
359$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
360
361llxHeader('', $title, $help_url);
362
363if ($object->id > 0) {
365
366 print dol_get_fiche_head($head, 'customer', $langs->trans("ThirdParty"), -1, 'company');
367
368 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
369
370 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
371
372 print '<div class="fichecenter"><div class="fichehalfleft">';
373
374 print '<div class="underbanner clearboth"></div>';
375 print '<table class="border centpercent tableforfield">';
376
377 // Nature Prospect/Customer/Supplier
378 print '<tr><td class="titlefieldmiddle">'.$langs->trans('NatureOfThirdParty').'</td><td>';
379 print $object->getTypeUrl(1);
380 print '</td></tr>';
381
382 // Prefix
383 if (getDolGlobalString('SOCIETE_USEPREFIX')) { // Old not used prefix field
384 print '<tr><td>'.$langs->trans("Prefix").'</td><td>';
385 print($object->prefix_comm ? $object->prefix_comm : '&nbsp;');
386 print '</td></tr>';
387 }
388
389 if ($object->client) {
390 $langs->loadLangs(array("compta", "accountancy"));
391
392 print '<tr><td>';
393 print $langs->trans('CustomerCode').'</td><td>';
395 $tmpcheck = $object->check_codeclient();
396 if ($tmpcheck != 0 && $tmpcheck != -5) {
397 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
398 }
399 print '</td></tr>';
400
401 if (isModEnabled('accounting')) {
402 $formaccounting = new FormAccounting($db);
403
404 print '<tr>';
405 print '<td>';
406 print $form->editfieldkey("CustomerAccountancyCodeGeneral", 'customeraccountancycodegeneral', length_accountg($object->accountancy_code_customer_general), $object, $permissiontoadd);
407 print '</td><td>';
408 if ($action == 'editcustomeraccountancycodegeneral' && $permissiontoadd) {
409 print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code_customer_general, 'customeraccountancycodegeneral', 0, 1, '', 1);
410 } else {
411 if ($object->accountancy_code_customer_general > 0) {
412 $accountingaccount = new AccountingAccount($db);
413 $accountingaccount->fetch(0, $object->accountancy_code_customer_general, 1);
414
415 print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
416 }
417 if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) {
418 if ($object->accountancy_code_customer_general > 0) {
419 print ' - ';
420 }
421 $accountingAccountByDefault = '<span class="opacitymedium">' . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) . '</span>';
422 print $accountingAccountByDefault;
423 }
424 }
425 print '</td>';
426 print '</tr>';
427 }
428
429 print '<tr>';
430 print '<td>';
431 print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $permissiontoadd);
432 print '</td><td>';
433 print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $permissiontoadd);
434 print '</td>';
435 print '</tr>';
436 }
437
438 // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier.
439 // We don't need them into customer profile.
440 // Except for spain and localtax where localtax depends on buyer and not seller
441
442 // VAT is used
443 /*
444 print '<tr>';
445 print '<td class="nowrap">';
446 print $form->textwithpicto($langs->trans('VATIsUsed'),$langs->trans('VATIsUsedWhenSelling'));
447 print '</td><td>';
448 print yn($object->tva_assuj);
449 print '</td>';
450 print '</tr>';
451 */
452
453 if ($mysoc->country_code == 'ES') {
454 // Local Taxes
455 if ($mysoc->localtax1_assuj == "1") {
456 print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
457 print yn($object->localtax1_assuj);
458 print '</td></tr>';
459 }
460 if ($mysoc->localtax1_assuj == "1") {
461 print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
462 print yn($object->localtax2_assuj);
463 print '</td></tr>';
464 }
465 }
466
467 // TVA Intra
468 print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
470 print '</td></tr>';
471
472 // default terms of the settlement
473 $langs->load('bills');
474 print '<tr><td>';
475 print '<table width="100%" class="nobordernopadding"><tr><td>';
476 print $langs->trans('PaymentConditions');
477 print '<td>';
478 if (($action != 'editconditions') && $permissiontoadd) {
479 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>';
480 }
481 print '</tr></table>';
482 print '</td><td>';
483 if ($action == 'editconditions') {
484 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent);
485 } else {
486 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent);
487 }
488 print "</td>";
489 print '</tr>';
490
491 // Default payment mode
492 print '<tr><td class="nowrap">';
493 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
494 print $langs->trans('PaymentMode');
495 print '<td>';
496 if (($action != 'editmode') && $permissiontoadd) {
497 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>';
498 }
499 print '</tr></table>';
500 print '</td><td>';
501 if ($action == 'editmode') {
502 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
503 } else {
504 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_id, 'none');
505 }
506 print "</td>";
507 print '</tr>';
508
509 if (isModEnabled("bank")) {
510 // Default bank account for payments
511 print '<tr><td class="nowrap">';
512 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
513 print $langs->trans('PaymentBankAccount');
514 print '<td>';
515 if (($action != 'editbankaccount') && $permissiontoadd) {
516 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>';
517 }
518 print '</tr></table>';
519 print '</td><td>';
520 if ($action == 'editbankaccount') {
521 $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->fk_account, 'fk_account', 1);
522 } else {
523 $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->fk_account, 'none');
524 }
525 print "</td>";
526 print '</tr>';
527 }
528
529 $isCustomer = ($object->client == 1 || $object->client == 3);
530
531 // Relative discounts (Discounts-Drawbacks-Rebates)
532 if ($isCustomer) {
533 print '<tr><td class="nowrap">';
534 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
535 print $langs->trans("CustomerRelativeDiscountShort");
536 print '<td><td class="right">';
537 if ($permissiontoadd && !$user->socid > 0) {
538 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>';
539 }
540 print '</td></tr></table>';
541 print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
542 print '</tr>';
543
544 // Absolute discounts (Discounts-Drawbacks-Rebates)
545 print '<tr><td class="nowrap">';
546 print '<table width="100%" class="nobordernopadding">';
547 print '<tr><td class="nowrap">';
548 print $langs->trans("CustomerAbsoluteDiscountShort");
549 print '<td><td class="right">';
550 if ($permissiontoadd && !$user->socid > 0) {
551 print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create_remise&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
552 }
553 print '</td></tr></table>';
554 print '</td>';
555 print '<td>';
556 $amount_discount = $object->getAvailableDiscounts();
557 if ($amount_discount < 0) {
558 dol_print_error($db, $object->error);
559 }
560 if ($amount_discount > 0) {
561 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>';
562 }
563 //else print $langs->trans("DiscountNone");
564 print '</td>';
565 print '</tr>';
566 }
567
568 $limit_field_type = '';
569 // Max outstanding bill
570 if ($object->client) {
571 print '<tr class="nowrap">';
572 print '<td>';
573 print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $permissiontoadd);
574 print '</td><td>';
575 $limit_field_type = (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE')) ? 'numeric' : 'amount';
576 print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $permissiontoadd, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
577 print '</td>';
578 print '</tr>';
579 }
580
581 if ($object->client) {
582 if (isModEnabled('order') && getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT')) {
583 print '<!-- Minimum amount for orders -->'."\n";
584 print '<tr class="nowrap">';
585 print '<td>';
586 print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $permissiontoadd);
587 print '</td><td>';
588 print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $permissiontoadd, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
589 print '</td>';
590 print '</tr>';
591 }
592 }
593
594
595 // Multiprice level
596 if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
597 print '<tr><td class="nowrap">';
598 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
599 print $langs->trans("PriceLevel");
600 print '<td><td class="right">';
601 if ($permissiontoadd) {
602 print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
603 }
604 print '</td></tr></table>';
605 print '</td><td>';
606 print $object->price_level;
607 $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
608 if (getDolGlobalString($keyforlabel)) {
609 print ' - '.$langs->trans(getDolGlobalString($keyforlabel));
610 }
611 print "</td>";
612 print '</tr>';
613 }
614
615 // Warehouse
616 if (isModEnabled('stock') && getDolGlobalString('SOCIETE_ASK_FOR_WAREHOUSE')) {
617 $langs->load('stocks');
618 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
619 $formproduct = new FormProduct($db);
620 print '<tr class="nowrap">';
621 print '<td>';
622 print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $permissiontoadd);
623 print '</td><td>';
624 if ($action == 'editwarehouse') {
625 $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
626 } else {
627 if ($object->fk_warehouse > 0) {
628 print img_picto('', 'stock', 'class="paddingrightonly"');
629 }
630 $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none');
631 }
632 print '</td>';
633 print '</tr>';
634 }
635
636 // Preferred shipping Method
637 if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD')) {
638 print '<tr><td class="nowrap">';
639 print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
640 print $langs->trans('SendingMethod');
641 print '<td>';
642 if (($action != 'editshipping') && $permissiontoadd) {
643 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
644 }
645 print '</tr></table>';
646 print '</td><td>';
647 if ($action == 'editshipping') {
648 $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1);
649 } else {
650 $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->shipping_method_id, 'none');
651 }
652 print "</td>";
653 print '</tr>';
654 }
655
656 if (isModEnabled('intracommreport')) {
657 $langs->load("intracommreport");
658
659 // Transport mode by default
660 print '<tr><td class="nowrap">';
661 print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
662 print $langs->trans('IntracommReportTransportMode');
663 print '<td>';
664 if (($action != 'edittransportmode') && $permissiontoadd) {
665 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
666 }
667 print '</tr></table>';
668 print '</td><td>';
669 if ($action == 'edittransportmode') {
670 $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, (!empty($object->transport_mode_id) ? $object->transport_mode_id : ''), 'transport_mode_id', 1, 1);
671 } else {
672 $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, (!empty($object->transport_mode_id) ? $object->transport_mode_id : ''), 'none');
673 }
674 print "</td>";
675 print '</tr>';
676 }
677
678 // Categories
679 if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
680 $langs->load("categories");
681 print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
682 print '<td>';
683 print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
684 print "</td></tr>";
685 }
686
687 // Other attributes
688 $parameters = array('socid' => $object->id);
689 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
690
691 // Sales representative
692 include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
693
694 // Module Adherent
695 if (isModEnabled('member')) {
696 $langs->load("members");
697 $langs->load("users");
698
699 print '<tr><td class="titlefield">'.$langs->trans("LinkedToDolibarrMember").'</td>';
700 print '<td>';
701 $adh = new Adherent($db);
702 $result = $adh->fetch(0, '', $object->id);
703 if ($result > 0) {
704 $adh->ref = $adh->getFullName($langs);
705 print $adh->getNomUrl(-1);
706 } else {
707 print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
708 }
709 print '</td>';
710 print "</tr>\n";
711 }
712
713 print "</table>";
714
715 print '</div><div class="fichehalfright">';
716
717 // Prospection level and status
718 if ($object->client == 2 || $object->client == 3) {
719 print '<div class="underbanner clearboth"></div>';
720 print '<table class="border centpercent tableforfield">';
721
722 // Level of prospection
723 print '<tr><td class="titlefield nowrap">';
724 print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
725 print $langs->trans('ProspectLevel');
726 print '<td>';
727 if ($action != 'editlevel' && $permissiontoadd) {
728 print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
729 }
730 print '</tr></table>';
731 print '</td><td>';
732 if ($action == 'editlevel') {
733 $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, (int) $object->fk_prospectlevel, 'prospect_level_id', 1);
734 } else {
735 print $object->getLibProspLevel();
736 }
737 print "</td>";
738 print '</tr>';
739
740 // Status of prospection
741 $object->loadCacheOfProspStatus();
742 print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
743 print ' &nbsp; &nbsp; ';
744 print '<div class="floatright">';
745 foreach ($object->cacheprospectstatus as $key => $val) {
746 $titlealt = 'default';
747 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
748 $titlealt = $val['label'];
749 }
750 if ($object->stcomm_id != $val['id']) {
751 print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm&token='.newToken().'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
752 }
753 }
754 print '</div></td></tr>';
755 print "</table>";
756
757 print '<br>';
758 } else {
759 print '<div class="underbanner underbanner-before-box clearboth"></div><br>';
760 }
761
762 $boxstat = '';
763
764 // Max nb of elements in lists
765 $MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT');
766
767 // Link summary/status board
768 $boxstat .= '<div class="box divboxtable box-halfright">';
769 $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
770 $boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
771
772 if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
773 // Box proposals
774 $tmp = $object->getOutstandingProposals();
775 $outstandingOpened = $tmp['opened'];
776 $outstandingTotal = $tmp['total_ht'];
777 $outstandingTotalIncTax = $tmp['total_ttc'];
778 $text = $langs->trans("OverAllProposals");
779 $link = DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id;
780 $icon = 'bill';
781 if ($link) {
782 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
783 }
784 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
785 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
786 $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
787 $boxstat .= '</div>';
788 if ($link) {
789 $boxstat .= '</a>';
790 }
791 }
792
793 if (isModEnabled('order') && $user->hasRight('commande', 'lire')) {
794 // Box orders
795 $tmp = $object->getOutstandingOrders();
796 $outstandingOpened = $tmp['opened'];
797 $outstandingTotal = $tmp['total_ht'];
798 $outstandingTotalIncTax = $tmp['total_ttc'];
799 $text = $langs->trans("OverAllOrders");
800 $link = DOL_URL_ROOT.'/commande/list.php?socid='.$object->id;
801 $icon = 'bill';
802 if ($link) {
803 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
804 }
805 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
806 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
807 $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
808 $boxstat .= '</div>';
809 if ($link) {
810 $boxstat .= '</a>';
811 }
812 }
813
814 if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
815 // Box invoices
816 $tmp = $object->getOutstandingBills('customer', 0);
817 $outstandingOpened = $tmp['opened'];
818 $outstandingTotal = $tmp['total_ht'];
819 $outstandingTotalIncTax = $tmp['total_ttc'];
820
821 $text = $langs->trans("OverAllInvoices");
822 $link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
823 $icon = 'bill';
824 if ($link) {
825 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
826 }
827 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
828 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
829 $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
830 $boxstat .= '</div>';
831 if ($link) {
832 $boxstat .= '</a>';
833 }
834
835 // Box outstanding bill
836 $warn = '';
837 if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened) {
838 $warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
839 }
840 $text = $langs->trans("CurrentOutstandingBill");
841 $link = DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
842 $icon = 'bill';
843 if ($link) {
844 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
845 }
846 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
847 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
848 $boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
849 $boxstat .= '</div>';
850 if ($link) {
851 $boxstat .= '</a>';
852 }
853
854 $tmp = $object->getOutstandingBills('customer', 1);
855 $outstandingOpenedLate = $tmp['opened'];
856 if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
857 $warn = '';
858 if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpenedLate) {
859 $warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
860 }
861 $text = $langs->trans("CurrentOutstandingBillLate");
862 $link = DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
863 $icon = 'bill';
864 if ($link) {
865 $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
866 }
867 $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
868 $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' <span>'.$text.'</span></span><br>';
869 $boxstat .= '<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
870 $boxstat .= '</div>';
871 if ($link) {
872 $boxstat .= '</a>';
873 }
874 }
875 }
876
877 $parameters = array();
878 $reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);
879 if (empty($reshook)) {
880 $boxstat .= $hookmanager->resPrint;
881 }
882
883 $boxstat .= '</td></tr>';
884 $boxstat .= '</table>';
885 $boxstat .= '</div>';
886
887 print $boxstat;
888
889
890 /*
891 * Latest proposals
892 */
893 if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
894 $langs->load("propal");
895
896 $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_projet, p.fk_statut, p.total_ht";
897 $sql .= ", p.total_tva";
898 $sql .= ", p.total_ttc";
899 $sql .= ", p.ref, p.ref_client, p.remise";
900 $sql .= ", p.datep as dp, p.fin_validite as date_limit, p.entity";
901 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
902 $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
903 $sql .= " AND s.rowid = ".((int) $object->id);
904 $sql .= " AND p.entity IN (".getEntity('propal').")";
905 $sql .= " ORDER BY p.datep DESC";
906
907 $resql = $db->query($sql);
908 if ($resql) {
909 $propal_static = new Propal($db);
910
911 $num = $db->num_rows($resql);
912 if ($num > 0) {
913 print '<div class="div-table-responsive-no-min">';
914 print '<table class="noborder centpercent lastrecordtable">';
915
916 print '<tr class="liste_titre">';
917 print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllPropals").'</span><span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
918 print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
919 print '</tr></table></td>';
920 print '</tr>';
921 }
922
923 $i = 0;
924 while ($i < $num && $i < $MAXLIST) {
925 $objp = $db->fetch_object($resql);
926
927 print '<tr class="oddeven">';
928 print '<td class="nowraponall">';
929 $propal_static->id = $objp->propalid;
930 $propal_static->ref = $objp->ref;
931 $propal_static->ref_client = $objp->ref_client; // deprecated
932 $propal_static->ref_customer = $objp->ref_client;
933 $propal_static->fk_project = $objp->fk_projet;
934 $propal_static->total_ht = $objp->total_ht;
935 $propal_static->total_tva = $objp->total_tva;
936 $propal_static->total_ttc = $objp->total_ttc;
937 print $propal_static->getNomUrl(1);
938
939 // Preview
940 $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
941 $file_list = null;
942 if (!empty($filedir)) {
943 $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
944 }
945 if (is_array($file_list) && !empty($file_list)) {
946 // Defined relative dir to DOL_DATA_ROOT
947 $relativedir = '';
948 if ($filedir) {
949 $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
950 $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
951 }
952 // Get list of files stored into database for same relative directory
953 if ($relativedir) {
954 completeFileArrayWithDatabaseInfo($file_list, $relativedir);
955 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
956
957 //var_dump($sortfield.' - '.$sortorder);
958 if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
959 $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
960 }
961 }
962 $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
963 print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, 'entity=' . $objp->entity);
964 }
965 print '</td><td class="tdoverflowmax125">';
966 if ($propal_static->fk_project > 0) {
967 $project->fetch($propal_static->fk_project);
968 print $project->getNomUrl(1);
969 }
970 // $filename = dol_sanitizeFileName($objp->ref);
971 // $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
972 // $urlsource = '/comm/propal/card.php?id='.$objp->cid;
973 // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir);
974 if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
975 print " ".img_warning();
976 }
977 print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
978 print '<td class="right nowraponall">'.price($objp->total_ht).'</td>';
979 print '<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).'</td></tr>';
980 $i++;
981 }
982 $db->free($resql);
983
984 if ($num > 0) {
985 print "</table>";
986 print '</div>';
987 }
988 } else {
989 dol_print_error($db);
990 }
991 }
992
993 $orders2invoice = null;
994 $param = "";
995 /*
996 * Latest orders
997 */
998 if (isModEnabled('order') && $user->hasRight('commande', 'lire')) {
999 $sql = "SELECT s.nom, s.rowid";
1000 $sql .= ", c.rowid as cid, c.entity, c.fk_projet, c.total_ht";
1001 $sql .= ", c.total_tva";
1002 $sql .= ", c.total_ttc";
1003 $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
1004 $sql .= ", c.date_commande as dc";
1005 $sql .= ", c.facture as billed";
1006 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
1007 $sql .= " WHERE c.fk_soc = s.rowid ";
1008 $sql .= " AND s.rowid = ".((int) $object->id);
1009 $sql .= " AND c.entity IN (".getEntity('commande').')';
1010 $sql .= " ORDER BY c.date_commande DESC";
1011
1012 $resql = $db->query($sql);
1013 if ($resql) {
1014 $commande_static = new Commande($db);
1015
1016 $num = $db->num_rows($resql);
1017 if ($num > 0) {
1018 // Check if there are orders billable
1019 $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
1020 $sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
1021 $sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
1022 $sql2 .= ', '.MAIN_DB_PREFIX.'commande as c';
1023 $sql2 .= ' WHERE c.fk_soc = s.rowid';
1024 $sql2 .= ' AND s.rowid = '.((int) $object->id);
1025 // Show orders with status validated, shipping started and delivered (well any order we can bill)
1026 $sql2 .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
1027
1028 $resql2 = $db->query($sql2);
1029 $orders2invoice = $db->num_rows($resql2);
1030 $db->free($resql2);
1031
1032 print '<div class="div-table-responsive-no-min">';
1033 print '<table class="noborder centpercent lastrecordtable">';
1034
1035 print '<tr class="liste_titre">';
1036 print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllOrders").'</span><span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
1037 print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
1038 print '</tr></table></td>';
1039 print '</tr>';
1040 }
1041
1042 $i = 0;
1043 while ($i < $num && $i < $MAXLIST) {
1044 $objp = $db->fetch_object($resql);
1045
1046 $commande_static->id = $objp->cid;
1047 $commande_static->ref = $objp->ref;
1048 $commande_static->ref_client = $objp->ref_client;
1049 $commande_static->fk_project = $objp->fk_projet;
1050 $commande_static->total_ht = $objp->total_ht;
1051 $commande_static->total_tva = $objp->total_tva;
1052 $commande_static->total_ttc = $objp->total_ttc;
1053 $commande_static->billed = $objp->billed;
1054
1055 print '<tr class="oddeven">';
1056 print '<td class="nowraponall">';
1057 print $commande_static->getNomUrl(1);
1058 // Preview
1059 $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1060 $file_list = null;
1061 if (!empty($filedir)) {
1062 $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
1063 }
1064 if (is_array($file_list) && !empty($file_list)) {
1065 // Defined relative dir to DOL_DATA_ROOT
1066 $relativedir = '';
1067 if ($filedir) {
1068 $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
1069 $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
1070 }
1071 // Get list of files stored into database for same relative directory
1072 if ($relativedir) {
1073 completeFileArrayWithDatabaseInfo($file_list, $relativedir);
1074 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1075
1076 //var_dump($sortfield.' - '.$sortorder);
1077 if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
1078 $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
1079 }
1080 }
1081 $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
1082 print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, 'entity=' . $objp->entity);
1083 }
1084 print '</td><td class="tdoverflowmax125">';
1085 if ($commande_static->fk_project > 0) {
1086 $project->fetch($commande_static->fk_project);
1087 print $project->getNomUrl(1);
1088 }
1089 // $filename = dol_sanitizeFileName($objp->ref);
1090 // $filedir = $conf->order->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1091 // $urlsource = '/commande/card.php?id='.$objp->cid;
1092 // print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir);
1093 print '</td>';
1094
1095 print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
1096 print '<td class="right nowraponall">'.price($objp->total_ht).'</td>';
1097 print '<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
1098 $i++;
1099 }
1100 $db->free($resql);
1101
1102 if ($num > 0) {
1103 print "</table>";
1104 print '</div>';
1105 }
1106 } else {
1107 dol_print_error($db);
1108 }
1109 }
1110
1111 /*
1112 * Latest shipments
1113 */
1114 if (isModEnabled("shipping") && $user->hasRight('expedition', 'lire')) {
1115 $param = '';
1116
1117 $sql = 'SELECT e.rowid as id';
1118 $sql .= ', e.ref, e.entity, e.fk_projet';
1119 $sql .= ', e.date_creation';
1120 $sql .= ', e.fk_statut as statut';
1121 $sql .= ', s.nom';
1122 $sql .= ', s.rowid as socid';
1123 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
1124 $sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
1125 $sql .= " AND e.entity IN (".getEntity('expedition').")";
1126 $sql .= ' GROUP BY e.rowid';
1127 $sql .= ', e.ref, e.entity, e.fk_projet';
1128 $sql .= ', e.date_creation';
1129 $sql .= ', e.fk_statut';
1130 $sql .= ', s.nom';
1131 $sql .= ', s.rowid';
1132 $sql .= " ORDER BY e.date_creation DESC";
1133
1134 $resql = $db->query($sql);
1135 if ($resql) {
1136 $sendingstatic = new Expedition($db);
1137
1138 $num = $db->num_rows($resql);
1139 if ($num > 0) {
1140 print '<div class="div-table-responsive-no-min">';
1141 print '<table class="noborder centpercent lastrecordtable">';
1142
1143 print '<tr class="liste_titre">';
1144 print '<td colspan="5"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num < $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllSendings").'</span><span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
1145 print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
1146 print '</tr></table></td>';
1147 print '</tr>';
1148 }
1149
1150 $i = 0;
1151 while ($i < $num && $i < $MAXLIST) {
1152 $objp = $db->fetch_object($resql);
1153
1154 $param = 'entity=' . ((int) $objp->entity);
1155
1156 $sendingstatic->id = $objp->id;
1157 $sendingstatic->ref = $objp->ref;
1158 $sendingstatic->fk_project = $objp->fk_projet;
1159
1160 print '<tr class="oddeven">';
1161 print '<td class="nowraponall">';
1162 print $sendingstatic->getNomUrl(1);
1163 // Preview
1164 $filedir = $conf->expedition->multidir_output[$objp->entity].'/sending/'.dol_sanitizeFileName($objp->ref);
1165 $file_list = null;
1166 if (!empty($filedir)) {
1167 $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
1168 }
1169 if (is_array($file_list) && !empty($file_list)) {
1170 // Defined relative dir to DOL_DATA_ROOT
1171 $relativedir = '';
1172 if ($filedir) {
1173 $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
1174 $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
1175 }
1176 // Get list of files stored into database for same relative directory
1177 if ($relativedir) {
1178 completeFileArrayWithDatabaseInfo($file_list, $relativedir);
1179 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1180
1181 //var_dump($sortfield.' - '.$sortorder);
1182 if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
1183 $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
1184 }
1185 }
1186 $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
1187
1188 print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param);
1189 }
1190 print '</td><td class="tdoverflowmax125">';
1191 if ($sendingstatic->fk_project > 0) {
1192 $project->fetch($sendingstatic->fk_project);
1193 print $project->getNomUrl(1);
1194 }
1195 // $filename = dol_sanitizeFileName($objp->ref);
1196 // $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1197 // $urlsource = '/expedition/card.php?id='.$objp->cid;
1198 // print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir);
1199 print '</td>';
1200 if ($objp->date_creation > 0) {
1201 print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
1202 } else {
1203 print '<td class="right"><b>!!!</b></td>';
1204 }
1205
1206 print '<td class="nowrap right">'.$sendingstatic->LibStatut($objp->statut, 5).'</td>';
1207 print "</tr>\n";
1208 $i++;
1209 }
1210 $db->free($resql);
1211
1212 if ($num > 0) {
1213 print "</table>";
1214 print '</div>';
1215 }
1216 } else {
1217 dol_print_error($db);
1218 }
1219 }
1220
1221 /*
1222 * Latest contracts
1223 */
1224 if (isModEnabled('contract') && $user->hasRight('contrat', 'lire')) {
1225 $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.fk_projet, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
1226 $sql .= " c.last_main_doc, c.model_pdf";
1227 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
1228 $sql .= " WHERE c.fk_soc = s.rowid ";
1229 $sql .= " AND s.rowid = ".((int) $object->id);
1230 $sql .= " AND c.entity IN (".getEntity('contract').")";
1231 $sql .= " ORDER BY c.datec DESC";
1232
1233 $resql = $db->query($sql);
1234 if ($resql) {
1235 $contrat = new Contrat($db);
1236
1237 $num = $db->num_rows($resql);
1238 if ($num > 0) {
1239 print '<div class="div-table-responsive-no-min">';
1240 print '<table class="noborder centpercent lastrecordtable">';
1241
1242 print '<tr class="liste_titre">';
1243 print '<td colspan="6"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
1244 print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
1245 //print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
1246 print '</tr></table></td>';
1247 print '</tr>';
1248 }
1249
1250 $i = 0;
1251 while ($i < $num && $i < $MAXLIST) {
1252 $objp = $db->fetch_object($resql);
1253
1254 $contrat->id = $objp->id;
1255 $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
1256 $contrat->ref_customer = $objp->refcus;
1257 $contrat->ref_supplier = $objp->refsup;
1258 $contrat->fk_project = $objp->fk_projet;
1259 $contrat->statut = $objp->contract_status; // deprecated
1260 $contrat->status = $objp->contract_status;
1261 $contrat->last_main_doc = $objp->last_main_doc;
1262 $contrat->model_pdf = $objp->model_pdf;
1263 $contrat->fetch_lines();
1264
1265 $late = '';
1266 foreach ($contrat->lines as $line) {
1267 if ($contrat->status == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
1268 if (((!empty($line->date_end) ? $line->date_end : 0) + $conf->contract->services->expires->warning_delay) < $now) {
1269 $late = img_warning($langs->trans("Late"));
1270 }
1271 }
1272 }
1273
1274 print '<tr class="oddeven">';
1275 print '<td class="nowraponall">';
1276 print $contrat->getNomUrl(1, 12);
1277 if (!empty($contrat->model_pdf)) {
1278 // Preview
1279 $filedir = $conf->contract->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1280 $file_list = null;
1281 if (!empty($filedir)) {
1282 $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
1283 }
1284 if (is_array($file_list) && !empty($file_list)) {
1285 // Defined relative dir to DOL_DATA_ROOT
1286 $relativedir = '';
1287 if ($filedir) {
1288 $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
1289 $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
1290 }
1291 // Get list of files stored into database for same relative directory
1292 if ($relativedir) {
1293 completeFileArrayWithDatabaseInfo($file_list, $relativedir);
1294 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1295
1296 //var_dump($sortfield.' - '.$sortorder);
1297 if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
1298 $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
1299 }
1300 }
1301 $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
1302 print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, 'entity=' . $objp->entity);
1303 }
1304 }
1305 // $filename = dol_sanitizeFileName($objp->ref);
1306 // $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1307 // $urlsource = '/contrat/card.php?id='.$objp->cid;
1308 // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir);
1309 print $late;
1310 print '</td><td class="tdoverflowmax125">';
1311 if ($contrat->fk_project > 0) {
1312 $project->fetch($contrat->fk_project);
1313 print $project->getNomUrl(1);
1314 }
1315 print "</td>\n";
1316 print '<td class="nowrap">';
1317 print dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12);
1318 print "</td>\n";
1319 //print '<td class="right" width="80px"><span title="'.$langs->trans("DateCreation").'">'.dol_print_date($db->jdate($objp->dc), 'day')."</span></td>\n";
1320 print '<td class="right" width="80px"><span title="'.$langs->trans("DateContract").'">'.dol_print_date($db->jdate($objp->dcon), 'day')."</span></td>\n";
1321 print '<td width="20">&nbsp;</td>';
1322 print '<td class="nowraponall right">';
1323 print $contrat->getLibStatut(4);
1324 print "</td>\n";
1325 print '</tr>';
1326 $i++;
1327 }
1328 $db->free($resql);
1329
1330 if ($num > 0) {
1331 print "</table>";
1332 print '</div>';
1333 }
1334 } else {
1335 dol_print_error($db);
1336 }
1337 }
1338
1339 /*
1340 * Latest interventions
1341 */
1342 if (isModEnabled('intervention') && $user->hasRight('ficheinter', 'lire')) {
1343 $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_projet, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity";
1344 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
1345 $sql .= " WHERE f.fk_soc = s.rowid";
1346 $sql .= " AND s.rowid = ".((int) $object->id);
1347 $sql .= " AND f.entity IN (".getEntity('intervention').")";
1348 $sql .= " ORDER BY f.tms DESC";
1349
1350 $resql = $db->query($sql);
1351 if ($resql) {
1352 $fichinter_static = new Fichinter($db);
1353
1354 $num = $db->num_rows($resql);
1355 if ($num > 0) {
1356 print '<div class="div-table-responsive-no-min">';
1357 print '<table class="noborder centpercent lastrecordtable">';
1358
1359 print '<tr class="liste_titre">';
1360 print '<td colspan="4"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllInterventions").'</span><span class="badge marginleftonlyshort">'.$num.'</span></td>';
1361 print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
1362 print '</tr></table></td>';
1363 print '</tr>';
1364 }
1365
1366 $i = 0;
1367 while ($i < $num && $i < $MAXLIST) {
1368 $objp = $db->fetch_object($resql);
1369
1370 $fichinter_static->id = $objp->id;
1371 $fichinter_static->ref = $objp->ref;
1372 $fichinter_static->statut = $objp->fk_statut; // deprecated
1373 $fichinter_static->status = $objp->fk_statut;
1374 $fichinter_static->fk_project = $objp->fk_projet;
1375
1376 print '<tr class="oddeven">';
1377 print '<td class="nowraponall">';
1378 print $fichinter_static->getNomUrl(1);
1379 // Preview
1380 $filedir = $conf->ficheinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1381 $file_list = null;
1382 if (!empty($filedir)) {
1383 $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
1384 }
1385 if (is_array($file_list) && !empty($file_list)) {
1386 // Defined relative dir to DOL_DATA_ROOT
1387 $relativedir = '';
1388 if ($filedir) {
1389 $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
1390 $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
1391 }
1392 // Get list of files stored into database for same relative directory
1393 if ($relativedir) {
1394 completeFileArrayWithDatabaseInfo($file_list, $relativedir);
1395 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1396
1397 //var_dump($sortfield.' - '.$sortorder);
1398 if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
1399 $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
1400 }
1401 }
1402 $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
1403 print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, 'entity=' . $objp->entity);
1404 }
1405 print '</td><td class="tdoverflowmax125">';
1406 if ($fichinter_static->fk_project > 0) {
1407 $project->fetch($fichinter_static->fk_project);
1408 print $project->getNomUrl(1);
1409 }
1410 // $filename = dol_sanitizeFileName($objp->ref);
1411 // $filedir = getMultidirOutput($fichinter_static).'/'.dol_sanitizeFileName($objp->ref);
1412 // $urlsource = '/fichinter/card.php?id='.$objp->cid;
1413 // print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir);
1414 print '</td>'."\n";
1415 //print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
1416 print '<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
1417 print '<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).'</td>'."\n";
1418 print '</tr>';
1419
1420 $i++;
1421 }
1422 $db->free($resql);
1423
1424 if ($num > 0) {
1425 print "</table>";
1426 print '</div>';
1427 }
1428 } else {
1429 dol_print_error($db);
1430 }
1431 }
1432
1433 /*
1434 * Latest invoices templates
1435 */
1436 if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
1437 $sql = 'SELECT f.rowid as id, f.titre as ref, f.fk_projet';
1438 $sql .= ', f.total_ht';
1439 $sql .= ', f.total_tva';
1440 $sql .= ', f.total_ttc';
1441 $sql .= ', f.datec as dc';
1442 $sql .= ', f.date_last_gen, f.date_when';
1443 $sql .= ', f.frequency';
1444 $sql .= ', f.unit_frequency';
1445 $sql .= ', f.suspended as suspended';
1446 $sql .= ', s.nom, s.rowid as socid';
1447 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
1448 $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
1449 $sql .= " AND f.entity IN (".getEntity('invoice').")";
1450 $sql .= ' GROUP BY f.rowid, f.titre, f.fk_projet, f.total_ht, f.total_tva, f.total_ttc,';
1451 $sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
1452 $sql .= ' f.suspended, f.date_when,';
1453 $sql .= ' s.nom, s.rowid';
1454 $sql .= " ORDER BY f.date_last_gen, f.datec DESC";
1455
1456 $resql = $db->query($sql);
1457 if ($resql) {
1458 $invoicetemplate = new FactureRec($db);
1459
1460 $num = $db->num_rows($resql);
1461 if ($num > 0) {
1462 print '<div class="div-table-responsive-no-min">';
1463 print '<table class="noborder centpercent lastrecordtable">';
1464 print '<tr class="liste_titre">';
1465 $colspan = 5;
1466 if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) {
1467 $colspan++;
1468 }
1469 print '<td colspan="'.$colspan.'">';
1470 print '<table class="centpercent nobordernopadding"><tr>';
1471 print '<td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllCustomerTemplateInvoices").'</span><span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
1472 print '</tr></table>';
1473 print '</td>';
1474 print '</tr>';
1475 }
1476
1477 $i = 0;
1478 while ($i < $num && $i < $MAXLIST) {
1479 $objp = $db->fetch_object($resql);
1480
1481 $invoicetemplate->id = $objp->id;
1482 $invoicetemplate->ref = $objp->ref;
1483 $invoicetemplate->fk_project = $objp->fk_projet;
1484 $invoicetemplate->suspended = $objp->suspended;
1485 $invoicetemplate->frequency = $objp->frequency;
1486 $invoicetemplate->unit_frequency = $objp->unit_frequency;
1487 $invoicetemplate->total_ht = $objp->total_ht;
1488 $invoicetemplate->total_tva = $objp->total_tva;
1489 $invoicetemplate->total_ttc = $objp->total_ttc;
1490 $invoicetemplate->date_last_gen = $objp->date_last_gen;
1491 $invoicetemplate->date_when = $objp->date_when;
1492
1493 print '<tr class="oddeven">';
1494 print '<td class="tdoverflowmax250">';
1495 print $invoicetemplate->getNomUrl(1);
1496 print '</td><td class="tdoverflowmax125">';
1497 if ($invoicetemplate->fk_project > 0) {
1498 $project->fetch($invoicetemplate->fk_project);
1499 print $project->getNomUrl(1);
1500 }
1501 print '</td>';
1502
1503 if ($objp->frequency && $objp->date_last_gen > 0) {
1504 print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen), 'day').'</td>';
1505 } else {
1506 if ($objp->dc > 0) {
1507 print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day').'</td>';
1508 } else {
1509 print '<td class="right"><b>!!!</b></td>';
1510 }
1511 }
1512 print '<td class="right nowraponall">';
1513 print price($objp->total_ht);
1514 print '</td>';
1515
1516 if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) {
1517 print '<td class="right nowraponall">';
1518 print price($objp->total_ttc);
1519 print '</td>';
1520 }
1521
1522 print '<td class="nowrap right" style="min-width: 60px">';
1523 print $langs->trans('FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).' - ';
1524 print($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0));
1525 print '</td>';
1526 print "</tr>\n";
1527 $i++;
1528 }
1529 $db->free($resql);
1530
1531 if ($num > 0) {
1532 print "</table>";
1533 print '</div>';
1534 }
1535 } else {
1536 dol_print_error($db);
1537 }
1538 }
1539
1540 /*
1541 * Latest invoices
1542 */
1543 if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
1544 $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.ref_client, f.fk_projet';
1545 $sql .= ', f.total_ht';
1546 $sql .= ', f.total_tva';
1547 $sql .= ', f.total_ttc';
1548 $sql .= ', f.entity';
1549 $sql .= ', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
1550 $sql .= ', s.nom, s.rowid as socid';
1551 $sql .= ', SUM(pf.amount) as am';
1552 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
1553 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
1554 $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
1555 $sql .= " AND f.entity IN (".getEntity('invoice').")";
1556 $sql .= ' GROUP BY f.rowid, f.ref, f.type, f.ref_client, f.fk_projet, f.total_ht, f.total_tva, f.total_ttc,';
1557 $sql .= ' f.entity, f.datef, f.date_lim_reglement, f.datec, f.paye, f.fk_statut,';
1558 $sql .= ' s.nom, s.rowid';
1559 $sql .= " ORDER BY f.datef DESC, f.datec DESC";
1560
1561 $resql = $db->query($sql);
1562 if ($resql) {
1563 $facturestatic = new Facture($db);
1564
1565 $num = $db->num_rows($resql);
1566 if ($num > 0) {
1567 print '<div class="div-table-responsive-no-min">';
1568 print '<table class="noborder centpercent lastrecordtable">';
1569 print '<tr class="liste_titre">';
1570 $colspan = 6;
1571 if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) {
1572 $colspan++;
1573 }
1574 if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) {
1575 $colspan++;
1576 }
1577 print '<td colspan="'.$colspan.'">';
1578 print '<table class="centpercent nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllBills").'</span><span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
1579 print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
1580 print '</tr></table>';
1581 print '</td>';
1582 print '</tr>';
1583 }
1584
1585 $i = 0;
1586 while ($i < $num && $i < $MAXLIST) {
1587 $objp = $db->fetch_object($resql);
1588
1589 $facturestatic->id = $objp->facid;
1590 $facturestatic->ref = $objp->ref;
1591 $facturestatic->ref_client = $objp->ref_client;
1592 $facturestatic->fk_project = $objp->fk_projet;
1593 $facturestatic->type = $objp->type;
1594 $facturestatic->total_ht = $objp->total_ht;
1595 $facturestatic->total_tva = $objp->total_tva;
1596 $facturestatic->total_ttc = $objp->total_ttc;
1597 $facturestatic->statut = $objp->status; // deprecated
1598 $facturestatic->status = $objp->status;
1599 $facturestatic->paye = $objp->paye;
1600 $facturestatic->alreadypaid = $objp->am;
1601 $facturestatic->totalpaid = $objp->am;
1602 $facturestatic->date = $db->jdate($objp->df);
1603 $facturestatic->date_lim_reglement = $db->jdate($objp->dl);
1604
1605 print '<tr class="oddeven">';
1606 print '<td class="nowraponall">';
1607 print $facturestatic->getNomUrl(1);
1608 // Preview
1609 $filedir = $conf->invoice->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1610 $file_list = null;
1611 if (!empty($filedir)) {
1612 $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
1613 }
1614 if (is_array($file_list) && !empty($file_list)) {
1615 // Defined relative dir to DOL_DATA_ROOT
1616 $relativedir = '';
1617 if ($filedir) {
1618 $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
1619 $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
1620 }
1621 // Get list of files stored into database for same relative directory
1622 if ($relativedir) {
1623 completeFileArrayWithDatabaseInfo($file_list, $relativedir);
1624 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1625
1626 //var_dump($sortfield.' - '.$sortorder);
1627 if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
1628 $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
1629 }
1630 }
1631 $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
1632 print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, 'entity=' . $objp->entity);
1633 }
1634 print '</td><td class="tdoverflowmax125">';
1635 if ($facturestatic->fk_project > 0) {
1636 $project->fetch($facturestatic->fk_project);
1637 print $project->getNomUrl(1);
1638 }
1639 // $filename = dol_sanitizeFileName($objp->ref);
1640 // $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
1641 // $urlsource = '/compta/facture/card.php?id='.$objp->cid;
1642 //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
1643 print '</td>';
1644 if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) {
1645 print '<td class="nowraponall">';
1646 print dolPrintHTML($objp->ref_client);
1647 print '</td>';
1648 }
1649 if ($objp->df > 0) {
1650 print '<td width="80px" title="'.dol_escape_htmltag($langs->trans('DateInvoice')).'">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
1651 } else {
1652 print '<td><b>!!!</b></td>';
1653 }
1654 if ($objp->dl > 0) {
1655 print '<td width="80px" title="'.dol_escape_htmltag($langs->trans('DateMaxPayment')).'">'.dol_print_date($db->jdate($objp->dl), 'day').'</td>';
1656 } else {
1657 print '<td><b>!!!</b></td>';
1658 }
1659
1660 print '<td class="right nowraponall">';
1661 print price($objp->total_ht);
1662 print '</td>';
1663
1664 if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) {
1665 print '<td class="right nowraponall">';
1666 print price($objp->total_ttc);
1667 print '</td>';
1668 }
1669
1670 print '<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->status, 5, $objp->am)).'</td>';
1671 print "</tr>\n";
1672 $i++;
1673 }
1674 $db->free($resql);
1675
1676 if ($num > 0) {
1677 print "</table>";
1678 print '</div>';
1679 }
1680 } else {
1681 dol_print_error($db);
1682 }
1683 }
1684
1685 // Allow external modules to add their own shortlist of recent objects
1686 $parameters = array();
1687 $reshook = $hookmanager->executeHooks('addMoreRecentObjects', $parameters, $object, $action);
1688 if ($reshook < 0) {
1689 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1690 } else {
1691 print $hookmanager->resPrint;
1692 }
1693
1694 print '</div></div>';
1695 print '<div class="clearboth"></div>';
1696
1697 print dol_get_fiche_end();
1698
1699
1700 /*
1701 * Action bar
1702 */
1703 print '<div class="tabsAction">';
1704
1705 $parameters = array();
1706 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1707
1708 if (empty($reshook)) {
1709 if ($object->status != 1) {
1710 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
1711 }
1712
1713 if (isModEnabled("propal") && $user->hasRight('propal', 'creer') && $object->status == 1) {
1714 $langs->load("propal");
1715 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
1716 }
1717
1718 if (isModEnabled('order') && $user->hasRight('commande', 'creer') && $object->status == 1) {
1719 $langs->load("orders");
1720 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
1721 }
1722
1723 if ($user->hasRight('contrat', 'creer') && $object->status == 1) {
1724 $langs->load("contracts");
1725 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
1726 }
1727
1728 if (isModEnabled('intervention') && $user->hasRight('ficheinter', 'creer') && $object->status == 1) {
1729 $langs->load("interventions");
1730 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
1731 }
1732
1733 // Add invoice
1734 if (isModEnabled('deplacement') && $object->status == 1) {
1735 $langs->load("trips");
1736 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
1737 }
1738
1739 if (isModEnabled('invoice') && $object->status == 1) {
1740 if (!$user->hasRight('facture', 'creer')) {
1741 $langs->load("bills");
1742 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
1743 } else {
1744 $langs->loadLangs(array("orders", "bills"));
1745
1746 if ($object->client != 0 && $object->client != 2) {
1747 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
1748 } else {
1749 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
1750 }
1751 }
1752 }
1753
1754 if (isModEnabled('invoice') && $object->status == 1) {
1755 if ($user->hasRight('facture', 'creer')) {
1756 if (isModEnabled('order')) {
1757 if ($object->client != 0 && $object->client != 2) {
1758 if (!empty($orders2invoice) && $orders2invoice > 0) {
1759 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
1760 } else {
1761 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
1762 }
1763 } else {
1764 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
1765 }
1766 }
1767 }
1768 }
1769
1770 // Add action
1771 if (isModEnabled('agenda') && getDolGlobalString('MAIN_REPEATTASKONEACHTAB') && $object->status == 1) {
1772 if ($user->hasRight('agenda', 'myactions', 'create')) {
1773 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
1774 } else {
1775 print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
1776 }
1777 }
1778 }
1779
1780 print '</div>';
1781
1782 if (getDolGlobalString('MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD')) {
1783 // List of contacts
1784 show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
1785 }
1786
1787 if (getDolGlobalString('MAIN_REPEATTASKONEACHTAB')) {
1788 print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
1789
1790 // List of todo actions
1791 show_actions_todo($conf, $langs, $db, $object);
1792
1793 // List of done actions
1794 show_actions_done($conf, $langs, $db, $object);
1795 }
1796} else {
1797 recordNotFound('', 0);
1798}
1799
1800// End of page
1801llxFooter();
1802$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage accounting accounts.
Class to manage members of a foundation.
Class to manage customers or prospects.
Class to manage customers orders.
Class to manage contact/addresses.
Class to manage standard extra fields.
Class to manage invoices.
Class to manage invoice templates.
Class to manage generation of HTML components for accounting management.
Class to build HTML component for third parties management Only common components are here.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage projects.
Class to manage proposals.
Class to manage Dolibarr users.
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.
completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object=null)
Complete $filearray with data from database.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:63
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
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_now($mode='auto')
Return date for now.
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).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.