30 require
"../main.inc.php";
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
37 $optioncss =
GETPOST(
'optioncss',
'aZ');
38 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
46 if (empty($object->thirdparty)) {
47 $object->fetch_thirdparty();
49 $socid = $object->thirdparty->id;
52 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
53 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
56 if (empty($page) || $page == -1) {
59 $offset = $limit * $page;
60 $pageprev = $page - 1;
61 $pagenext = $page + 1;
66 $sortfield =
'dateprint';
71 $sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
72 $month =
GETPOST(
'month',
'int');
76 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
78 $sprod_fulldescr =
'';
83 $thirdTypeSelect =
GETPOST(
"third_select_id");
87 $langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
90 $hookmanager->initHooks(array(
'consumptioncontact'));
92 $result =
restrictedArea($user,
'contact', $object->id,
'socpeople&societe');
99 $parameters = array(
'id'=>$id);
100 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
111 $productstatic =
new Product($db);
114 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
115 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
124 print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ContactsAddresses"), -1,
'contact');
126 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
128 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.$object->id.
'" class="refid">';
129 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
130 $morehtmlref .=
'</a>';
132 $morehtmlref .=
'<div class="refidno">';
133 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
134 $objsoc->fetch($socid);
136 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
137 if ($objsoc->id > 0) {
138 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
140 $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
143 $morehtmlref .=
'</div>';
145 dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
147 print
'<div class="fichecenter">';
149 print
'<div class="underbanner clearboth"></div>';
150 print
'<table class="border centpercent tableforfield">';
153 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
154 print $object->getCivilityLabel();
157 if ($object->thirdparty->client) {
158 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
159 if (
isModEnabled(
"propal") && $user->rights->propal->lire) {
160 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
162 if (
isModEnabled(
'commande') && $user->rights->commande->lire) {
163 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
165 if (
isModEnabled(
'facture') && $user->rights->facture->lire) {
166 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
168 if (
isModEnabled(
'contrat') && $user->rights->contrat->lire) {
169 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
173 if (
isModEnabled(
'ficheinter') && $user->rights->ficheinter->lire) {
174 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
177 if ($object->thirdparty->fournisseur) {
178 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
179 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (
isModEnabled(
"supplier_invoice") && $user->rights->supplier_invoice->lire)) {
180 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
182 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (
isModEnabled(
"supplier_order") && $user->rights->supplier_order->lire)) {
183 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
198 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
199 print
'<input type="hidden" name="token" value="'.newToken().
'">';
202 if ($type_element ==
'fichinter') {
203 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
205 $sql_select =
'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle as type_contact_label, ';
206 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
207 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
208 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
209 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)";
210 $where =
' WHERE f.entity IN ('.getEntity(
'ficheinter').
')';
211 $dateprint =
'f.datec';
212 $doc_number =
'f.ref';
213 } elseif ($type_element ==
'invoice') {
214 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
215 $documentstatic =
new Facture($db);
216 $sql_select =
'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle as type_contact_label, ';
217 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
218 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
219 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
220 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
221 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)";
222 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
223 $dateprint =
'f.datef';
224 $doc_number =
'f.ref';
225 $thirdTypeSelect =
'customer';
226 } elseif ($type_element ==
'propal') {
227 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
228 $documentstatic =
new Propal($db);
229 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
230 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
231 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
232 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
233 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
234 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
235 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
236 $dateprint =
'c.datep';
237 $doc_number =
'c.ref';
238 $thirdTypeSelect =
'customer';
239 } elseif ($type_element ==
'order') {
240 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
241 $documentstatic =
new Commande($db);
242 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
243 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
244 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
245 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
246 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
247 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)";
248 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
249 $dateprint =
'c.date_commande';
250 $doc_number =
'c.ref';
251 $thirdTypeSelect =
'customer';
252 } elseif ($type_element ==
'supplier_invoice') {
253 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
255 $sql_select =
'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle as type_contact_label, ';
256 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
257 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
258 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
259 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
260 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)";
261 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
262 $dateprint =
'f.datef';
263 $doc_number =
'f.ref';
264 $thirdTypeSelect =
'supplier';
277 } elseif ($type_element ==
'supplier_order') {
278 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
280 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
281 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
282 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
283 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
284 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
285 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)";
286 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
287 $dateprint =
'c.date_valid';
288 $doc_number =
'c.ref';
289 $thirdTypeSelect =
'supplier';
290 } elseif ($type_element ==
'contract') {
291 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
292 $documentstatic =
new Contrat($db);
294 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, tc.libelle as type_contact_label, ';
295 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
296 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
297 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
298 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
299 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)";
300 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
301 $dateprint =
'c.date_valid';
302 $doc_number =
'c.ref';
303 $thirdTypeSelect =
'customer';
306 $parameters = array();
307 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
309 if (!empty($sql_select)) {
311 $sql .=
' d.description as description';
312 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
313 $sql .=
', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
315 if ($type_element ==
'supplier_proposal') {
316 $sql .=
', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
318 if ($type_element ==
'contract') {
319 $sql .=
', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
321 if ($type_element !=
'fichinter') {
322 $sql .=
' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity';
325 if ($type_element !=
'fichinter') {
326 $sql .=
", p.ref as prod_ref, p.label as product_label";
328 $sql .=
" FROM ".$tables_from;
333 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
335 if ($sprod_fulldescr) {
336 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
337 if (
GETPOST(
'type_element') !=
'fichinter') {
338 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
340 if (
GETPOST(
'type_element') !=
'fichinter') {
341 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
345 $sql .= $db->order($sortfield, $sortorder);
346 $resql = $db->query($sql);
347 $totalnboflines = $db->num_rows(
$resql);
349 $sql .= $db->plimit($limit + 1, $offset);
354 if (empty($elementTypeArray) && !$object->thirdparty->client && !$object->thirdparty->fournisseur) {
355 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
360 $typeElementString =
$form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
361 $button =
'<input type="submit" class="button small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
364 $param .=
"&sref=".urlencode($sref);
365 $param .=
"&month=".urlencode($month);
366 $param .=
"&year=".urlencode($year);
367 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
368 $param .=
"&socid=".urlencode($socid);
369 $param .=
"&type_element=".urlencode($type_element);
374 $resql = $db->query($sql);
379 $num = $db->num_rows(
$resql);
381 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element);
382 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
383 $param .=
'&contextpage='.urlencode($contextpage);
385 if ($limit > 0 && $limit != $conf->liste_limit) {
386 $param .=
'&limit='.urlencode($limit);
388 if ($sprod_fulldescr) {
389 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
392 $param .=
"&sref=".urlencode($sref);
395 $param .=
"&month=".urlencode($month);
398 $param .=
"&year=".urlencode($year);
400 if ($optioncss !=
'') {
401 $param .=
'&optioncss='.urlencode($optioncss);
404 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
406 print
'<div class="div-table-responsive-no-min">';
407 print
'<table class="liste centpercent">'.
"\n";
410 print
'<tr class="liste_titre">';
411 print
'<td class="liste_titre left">';
412 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
414 print
'<td class="liste_titre nowrap center">';
415 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
416 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1);
418 print
'<td class="liste_titre center">';
420 print
'<td class="liste_titre left">';
421 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
423 print
'<td class="liste_titre center">';
425 print
'<td class="liste_titre center">';
427 print
'<td class="liste_titre center">';
429 print
'<td class="liste_titre maxwidthsearch">';
430 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
436 print
'<tr class="liste_titre">';
437 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
438 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
439 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
441 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
442 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
443 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
444 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
451 while (($objp = $db->fetch_object(
$resql)) && $i < min($num, $limit)) {
452 $documentstatic->id = $objp->doc_id;
453 $documentstatic->ref = $objp->doc_number;
454 $documentstatic->type = $objp->doc_type;
455 $documentstatic->fk_statut = $objp->status;
456 $documentstatic->fk_status = $objp->status;
457 $documentstatic->statut = $objp->status;
458 $documentstatic->status = $objp->status;
459 $documentstatic->paye = $objp->paid;
460 $documentstatic->paid = $objp->paid;
462 if (is_object($documentstaticline)) {
463 $documentstaticline->statut = $objp->status;
466 print
'<tr class="oddeven">';
467 print
'<td class="nobordernopadding nowrap" width="100">';
468 print $documentstatic->getNomUrl(1);
470 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
473 print
'<td class="center">';
474 if ($type_element ==
'contract') {
475 print $documentstaticline->getLibStatut(2);
477 print $documentstatic->getLibStatut(2);
484 $text =
''; $description =
''; $type = 0;
487 if ($objp->fk_product > 0) {
488 $product_static =
new Product($db);
490 $product_static->type = $objp->fk_product_type;
491 $product_static->id = $objp->fk_product;
492 $product_static->ref = $objp->ref;
493 $product_static->entity = $objp->pentity;
494 $text = $product_static->getNomUrl(1);
498 if ($objp->fk_product > 0) {
500 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
502 $prod->fetch($objp->fk_product);
504 $outputlangs = $langs;
506 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
507 $newlang =
GETPOST(
'lang_id',
'aZ09');
509 if (empty($newlang)) {
510 $newlang = $object->default_lang;
512 if (!empty($newlang)) {
514 $outputlangs->setDefaultLang($newlang);
517 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
519 $label = $objp->product_label;
522 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
526 if (($objp->info_bits & 2) == 2) {
527 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$object->id.
'">';
529 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
530 if ($objp->description ==
'(DEPOSIT)') {
531 $txt = $langs->trans(
"Deposit");
532 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
533 $txt = $langs->trans(
"ExcessReceived");
534 } elseif ($objp->description ==
'(EXCESS PAID)') {
535 $txt = $langs->trans(
"ExcessPaid");
540 if ($objp->description) {
541 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
543 $discount->fetch($objp->fk_remise_except);
544 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
546 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
548 $discount->fetch($objp->fk_remise_except);
549 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
550 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
552 $discount->fetch($objp->fk_remise_except);
553 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
554 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
556 $discount->fetch($objp->fk_remise_except);
557 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
559 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
560 echo
' ('.dol_print_date($discount->datec).
')';
563 echo ($txt ?
' - ' :
'').dol_htmlentitiesbr($objp->description);
567 if ($objp->fk_product > 0) {
568 echo
$form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
575 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
578 if (!empty($objp->label) || !empty($objp->description)) {
580 $text =
img_object($langs->trans(
'Service'),
'service');
582 $text =
img_object($langs->trans(
'Product'),
'product');
585 if (!empty($objp->label)) {
586 $text .=
' <strong>'.$objp->label.
'</strong>';
618 print
'<td>'.$objp->type_contact_label.
'</td>';
620 print
'<td class="right">'.$objp->prod_qty.
'</td>';
621 $total_qty += $objp->prod_qty;
623 print
'<td class="right">'.price($objp->total_ht).
'</td>';
624 $total_ht += $objp->total_ht;
626 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
632 print
'<tr class="liste_total">';
633 print
'<td>'.$langs->trans(
'Total').
'</td>';
634 print
'<td colspan="3"></td>';
636 print
'<td class="right">'.$total_qty.
'</td>';
637 print
'<td class="right">'.price($total_ht).
'</td>';
638 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
643 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
646 } elseif (empty($type_element) || $type_element == -1) {
647 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
649 print
'<table class="liste centpercent">'.
"\n";
651 print
'<tr class="liste_titre">';
652 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
653 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
654 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
656 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
659 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
663 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
665 print
'<table class="liste centpercent">'.
"\n";
667 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage predefined suppliers products.
Class to manage customers orders.
Class to manage contracts.
Class to manage lines of contracts.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage interventions.
Class to manage products or services.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
get_date_range($date_start, $date_end, $format='', $outputlangs='', $withparenthesis=1)
Format output for start and end date.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isModEnabled($module)
Is Dolibarr module enabled.
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.