28 require
"../main.inc.php";
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
35 $optioncss =
GETPOST(
'optioncss',
'aZ');
36 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
44 if (empty($object->thirdparty)) {
45 $object->fetch_thirdparty();
47 $socid = $object->thirdparty->id;
50 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
51 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54 if (empty($page) || $page == -1) {
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
64 $sortfield =
'dateprint';
69 $sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
70 $month =
GETPOST(
'month',
'int');
74 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
76 $sprod_fulldescr =
'';
81 $thirdTypeSelect =
GETPOST(
"third_select_id");
85 $langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
88 $hookmanager->initHooks(array(
'consumptioncontact'));
90 $result =
restrictedArea($user,
'contact', $object->id,
'socpeople&societe');
97 $parameters = array(
'id'=>$id);
98 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
109 $productstatic =
new Product($db);
112 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
113 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
122 print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ContactsAddresses"), -1,
'contact');
124 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
126 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.$object->id.
'" class="refid">';
127 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
128 $morehtmlref .=
'</a>';
130 $morehtmlref .=
'<div class="refidno">';
131 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
132 $objsoc->fetch($socid);
134 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
135 if ($objsoc->id > 0) {
136 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
138 $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
141 $morehtmlref .=
'</div>';
143 dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
145 print
'<div class="fichecenter">';
147 print
'<div class="underbanner clearboth"></div>';
148 print
'<table class="border centpercent tableforfield">';
151 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
152 print $object->getCivilityLabel();
155 if ($object->thirdparty->client) {
156 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
157 if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
158 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
160 if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
161 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
163 if (
isModEnabled(
'facture') && $user->rights->facture->lire) {
164 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
166 if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
167 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
171 if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) {
172 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
175 if ($object->thirdparty->fournisseur) {
176 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
177 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
178 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
180 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
181 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
196 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
197 print
'<input type="hidden" name="token" value="'.newToken().
'">';
200 if ($type_element ==
'fichinter') {
201 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
203 $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, ';
204 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
205 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
206 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
207 $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)";
208 $where =
' WHERE f.entity IN ('.getEntity(
'ficheinter').
')';
209 $dateprint =
'f.datec';
210 $doc_number =
'f.ref';
211 } elseif ($type_element ==
'invoice') {
212 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
213 $documentstatic =
new Facture($db);
214 $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, ';
215 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
216 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
217 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
218 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
219 $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)";
220 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
221 $dateprint =
'f.datef';
222 $doc_number =
'f.ref';
223 $thirdTypeSelect =
'customer';
224 } elseif ($type_element ==
'propal') {
225 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
226 $documentstatic =
new Propal($db);
227 $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, ';
228 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
229 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
230 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
231 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
232 $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)";
233 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
234 $dateprint =
'c.datep';
235 $doc_number =
'c.ref';
236 $thirdTypeSelect =
'customer';
237 } elseif ($type_element ==
'order') {
238 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
239 $documentstatic =
new Commande($db);
240 $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, ';
241 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
242 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
243 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
244 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
245 $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)";
246 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
247 $dateprint =
'c.date_commande';
248 $doc_number =
'c.ref';
249 $thirdTypeSelect =
'customer';
250 } elseif ($type_element ==
'supplier_invoice') {
251 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
253 $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, ';
254 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
255 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
256 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
257 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
258 $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)";
259 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
260 $dateprint =
'f.datef';
261 $doc_number =
'f.ref';
262 $thirdTypeSelect =
'supplier';
275 } elseif ($type_element ==
'supplier_order') {
276 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
278 $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, ';
279 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
280 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
281 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
282 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
283 $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)";
284 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
285 $dateprint =
'c.date_valid';
286 $doc_number =
'c.ref';
287 $thirdTypeSelect =
'supplier';
288 } elseif ($type_element ==
'contract') {
289 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
290 $documentstatic =
new Contrat($db);
292 $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, ';
293 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
294 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
295 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
296 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
297 $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)";
298 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
299 $dateprint =
'c.date_valid';
300 $doc_number =
'c.ref';
301 $thirdTypeSelect =
'customer';
304 $parameters = array();
305 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
307 if (!empty($sql_select)) {
309 $sql .=
' d.description as description';
310 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
311 $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, ';
313 if ($type_element ==
'supplier_proposal') {
314 $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, ';
316 if ($type_element ==
'contract') {
317 $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, ';
319 if ($type_element !=
'fichinter') {
320 $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';
323 if ($type_element !=
'fichinter') {
324 $sql .=
", p.ref as prod_ref, p.label as product_label";
326 $sql .=
" FROM ".$tables_from;
331 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
333 if ($sprod_fulldescr) {
334 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
335 if (
GETPOST(
'type_element') !=
'fichinter') {
336 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
338 if (
GETPOST(
'type_element') !=
'fichinter') {
339 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
343 $sql .= $db->order($sortfield, $sortorder);
344 $resql = $db->query($sql);
345 $totalnboflines = $db->num_rows(
$resql);
347 $sql .= $db->plimit($limit + 1, $offset);
352 if (empty($elementTypeArray) && !$object->thirdparty->client && !$object->thirdparty->fournisseur) {
353 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
358 $typeElementString =
$form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
359 $button =
'<input type="submit" class="button small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
362 $param .=
"&sref=".urlencode($sref);
363 $param .=
"&month=".urlencode($month);
364 $param .=
"&year=".urlencode($year);
365 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
366 $param .=
"&socid=".urlencode($socid);
367 $param .=
"&type_element=".urlencode($type_element);
372 $resql = $db->query($sql);
377 $num = $db->num_rows(
$resql);
379 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element).
"&id=".urlencode($id);
380 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
381 $param .=
'&contextpage='.urlencode($contextpage);
383 if ($limit > 0 && $limit != $conf->liste_limit) {
384 $param .=
'&limit='.urlencode($limit);
386 if ($sprod_fulldescr) {
387 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
390 $param .=
"&sref=".urlencode($sref);
393 $param .=
"&month=".urlencode($month);
396 $param .=
"&year=".urlencode($year);
398 if ($optioncss !=
'') {
399 $param .=
'&optioncss='.urlencode($optioncss);
402 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
404 print
'<div class="div-table-responsive-no-min">';
405 print
'<table class="liste centpercent">'.
"\n";
408 print
'<tr class="liste_titre">';
409 print
'<td class="liste_titre left">';
410 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
412 print
'<td class="liste_titre nowrap center">';
413 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
414 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1);
416 print
'<td class="liste_titre center">';
418 print
'<td class="liste_titre left">';
419 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
421 print
'<td class="liste_titre center">';
423 print
'<td class="liste_titre center">';
425 print
'<td class="liste_titre center">';
427 print
'<td class="liste_titre maxwidthsearch">';
428 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
434 print
'<tr class="liste_titre">';
435 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
436 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
437 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
439 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
440 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
441 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
442 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
449 while (($objp = $db->fetch_object(
$resql)) && $i < min($num, $limit)) {
450 $documentstatic->id = $objp->doc_id;
451 $documentstatic->ref = $objp->doc_number;
452 $documentstatic->type = $objp->doc_type;
453 $documentstatic->fk_statut = $objp->status;
454 $documentstatic->fk_status = $objp->status;
455 $documentstatic->statut = $objp->status;
456 $documentstatic->status = $objp->status;
457 $documentstatic->paye = $objp->paid;
458 $documentstatic->paid = $objp->paid;
460 if (is_object($documentstaticline)) {
461 $documentstaticline->statut = $objp->status;
464 print
'<tr class="oddeven">';
465 print
'<td class="nobordernopadding nowrap" width="100">';
466 print $documentstatic->getNomUrl(1);
468 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
471 print
'<td class="center">';
472 if ($type_element ==
'contract') {
473 print $documentstaticline->getLibStatut(2);
475 print $documentstatic->getLibStatut(2);
482 $text =
''; $description =
''; $type = 0;
485 if ($objp->fk_product > 0) {
486 $product_static =
new Product($db);
488 $product_static->type = $objp->fk_product_type;
489 $product_static->id = $objp->fk_product;
490 $product_static->ref = $objp->ref;
491 $product_static->entity = $objp->pentity;
492 $text = $product_static->getNomUrl(1);
496 if ($objp->fk_product > 0) {
498 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
500 $prod->fetch($objp->fk_product);
502 $outputlangs = $langs;
504 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
505 $newlang =
GETPOST(
'lang_id',
'aZ09');
507 if (empty($newlang)) {
508 $newlang = $object->default_lang;
510 if (!empty($newlang)) {
512 $outputlangs->setDefaultLang($newlang);
515 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
517 $label = $objp->product_label;
520 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
521 $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ?
'' :
dol_htmlentitiesbr($objp->description));
524 if (($objp->info_bits & 2) == 2) {
525 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$object->id.
'">';
527 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
528 if ($objp->description ==
'(DEPOSIT)') {
529 $txt = $langs->trans(
"Deposit");
530 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
531 $txt = $langs->trans(
"ExcessReceived");
532 } elseif ($objp->description ==
'(EXCESS PAID)') {
533 $txt = $langs->trans(
"ExcessPaid");
538 if ($objp->description) {
539 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
541 $discount->fetch($objp->fk_remise_except);
542 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
544 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
546 $discount->fetch($objp->fk_remise_except);
547 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
548 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
550 $discount->fetch($objp->fk_remise_except);
551 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
552 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
554 $discount->fetch($objp->fk_remise_except);
555 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
557 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
558 echo
' ('.dol_print_date($discount->datec).
')';
561 echo ($txt ?
' - ' :
'').dol_htmlentitiesbr($objp->description);
565 if ($objp->fk_product > 0) {
566 echo
$form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
572 if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
573 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
576 if (!empty($objp->label) || !empty($objp->description)) {
578 $text =
img_object($langs->trans(
'Service'),
'service');
580 $text =
img_object($langs->trans(
'Product'),
'product');
583 if (!empty($objp->label)) {
584 $text .=
' <strong>'.$objp->label.
'</strong>';
616 print
'<td>'.$objp->type_contact_label.
'</td>';
618 print
'<td class="right">'.$objp->prod_qty.
'</td>';
619 $total_qty += $objp->prod_qty;
621 print
'<td class="right">'.price($objp->total_ht).
'</td>';
622 $total_ht += $objp->total_ht;
624 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
630 print
'<tr class="liste_total">';
631 print
'<td>'.$langs->trans(
'Total').
'</td>';
632 print
'<td colspan="3"></td>';
634 print
'<td class="right">'.$total_qty.
'</td>';
635 print
'<td class="right">'.price($total_ht).
'</td>';
636 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
641 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
644 } elseif (empty($type_element) || $type_element == -1) {
645 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
647 print
'<table class="liste centpercent">'.
"\n";
649 print
'<tr class="liste_titre">';
650 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
651 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
652 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
654 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
657 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
661 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
663 print
'<table class="liste centpercent">'.
"\n";
665 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';