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 if ($objsoc->id > 0) {
137 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
139 $morehtmlref .=
'<span class="opacitymedium">'.$langs->trans(
"ContactNotLinkedToCompany").
'</span>';
142 $morehtmlref .=
'</div>';
144 dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
146 print
'<div class="fichecenter">';
148 print
'<div class="underbanner clearboth"></div>';
149 print
'<table class="border centpercent tableforfield">';
152 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
153 print $object->getCivilityLabel();
156 if ($object->thirdparty->client) {
157 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
158 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
159 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
161 if (
isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
162 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
164 if (
isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')) {
165 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
167 if (
isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
168 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
172 if (
isModEnabled(
'ficheinter') && $user->hasRight(
'ficheinter',
'lire')) {
173 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
176 if ($object->thirdparty->fournisseur) {
177 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
178 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (
isModEnabled(
"supplier_invoice") && $user->rights->supplier_invoice->lire)) {
179 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
181 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (
isModEnabled(
"supplier_order") && $user->rights->supplier_order->lire)) {
182 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
197 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
198 print
'<input type="hidden" name="token" value="'.newToken().
'">';
201 if ($type_element ==
'fichinter') {
202 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
204 $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, ';
205 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
206 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
207 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
208 $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)";
209 $where =
' WHERE f.entity IN ('.getEntity(
'ficheinter').
')';
210 $dateprint =
'f.datec';
211 $doc_number =
'f.ref';
212 } elseif ($type_element ==
'invoice') {
213 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
214 $documentstatic =
new Facture($db);
215 $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, ';
216 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
217 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
218 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
219 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
220 $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)";
221 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
222 $dateprint =
'f.datef';
223 $doc_number =
'f.ref';
224 $thirdTypeSelect =
'customer';
225 } elseif ($type_element ==
'propal') {
226 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
227 $documentstatic =
new Propal($db);
228 $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, ';
229 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
230 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
231 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
232 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
233 $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)";
234 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
235 $dateprint =
'c.datep';
236 $doc_number =
'c.ref';
237 $thirdTypeSelect =
'customer';
238 } elseif ($type_element ==
'order') {
239 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
240 $documentstatic =
new Commande($db);
241 $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, ';
242 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
243 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
244 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
245 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
246 $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)";
247 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
248 $dateprint =
'c.date_commande';
249 $doc_number =
'c.ref';
250 $thirdTypeSelect =
'customer';
251 } elseif ($type_element ==
'supplier_invoice') {
252 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
254 $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, ';
255 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
256 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
257 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
258 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
259 $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)";
260 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
261 $dateprint =
'f.datef';
262 $doc_number =
'f.ref';
263 $thirdTypeSelect =
'supplier';
276 } elseif ($type_element ==
'supplier_order') {
277 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
279 $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, ';
280 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
281 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
282 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
283 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
284 $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)";
285 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
286 $dateprint =
'c.date_valid';
287 $doc_number =
'c.ref';
288 $thirdTypeSelect =
'supplier';
289 } elseif ($type_element ==
'contract') {
290 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
291 $documentstatic =
new Contrat($db);
293 $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, ';
294 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
295 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
296 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
297 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
298 $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)";
299 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
300 $dateprint =
'c.date_valid';
301 $doc_number =
'c.ref';
302 $thirdTypeSelect =
'customer';
305 $parameters = array();
306 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
308 if (!empty($sql_select)) {
310 $sql .=
' d.description as description';
311 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
312 $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, ';
314 if ($type_element ==
'supplier_proposal') {
315 $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, ';
317 if ($type_element ==
'contract') {
318 $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, ';
320 if ($type_element !=
'fichinter') {
321 $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';
324 if ($type_element !=
'fichinter') {
325 $sql .=
", p.ref as prod_ref, p.label as product_label";
327 $sql .=
" FROM ".$tables_from;
332 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
334 if ($sprod_fulldescr) {
335 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
336 if (
GETPOST(
'type_element') !=
'fichinter') {
337 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
339 if (
GETPOST(
'type_element') !=
'fichinter') {
340 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
344 $sql .= $db->order($sortfield, $sortorder);
345 $resql = $db->query(
$sql);
346 $totalnboflines = $db->num_rows($resql);
348 $sql .= $db->plimit($limit + 1, $offset);
353 if (empty($elementTypeArray) && !$object->thirdparty->client && !$object->thirdparty->fournisseur) {
354 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
359 $typeElementString =
$form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
360 $button =
'<input type="submit" class="button small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
363 $param .=
"&sref=".urlencode($sref);
364 $param .=
"&month=".urlencode($month);
365 $param .=
"&year=".urlencode($year);
366 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
367 $param .=
"&socid=".urlencode($socid);
368 $param .=
"&type_element=".urlencode($type_element);
373 $resql = $db->query(
$sql);
378 $num = $db->num_rows($resql);
380 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element).
"&id=".urlencode($id);
381 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
382 $param .=
'&contextpage='.urlencode($contextpage);
384 if ($limit > 0 && $limit != $conf->liste_limit) {
385 $param .=
'&limit='.((int) $limit);
387 if ($sprod_fulldescr) {
388 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
391 $param .=
"&sref=".urlencode($sref);
394 $param .=
"&month=".urlencode($month);
397 $param .=
"&year=".urlencode($year);
399 if ($optioncss !=
'') {
400 $param .=
'&optioncss='.urlencode($optioncss);
403 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
405 print
'<div class="div-table-responsive-no-min">';
406 print
'<table class="liste centpercent">'.
"\n";
409 print
'<tr class="liste_titre">';
410 print
'<td class="liste_titre left">';
411 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
413 print
'<td class="liste_titre nowrap center">';
414 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
415 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1);
417 print
'<td class="liste_titre center">';
419 print
'<td class="liste_titre left">';
420 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
422 print
'<td class="liste_titre center">';
424 print
'<td class="liste_titre center">';
426 print
'<td class="liste_titre center">';
428 print
'<td class="liste_titre maxwidthsearch">';
429 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
435 print
'<tr class="liste_titre">';
436 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
437 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
438 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
440 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
441 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
442 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
443 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
450 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
451 $documentstatic->id = $objp->doc_id;
452 $documentstatic->ref = $objp->doc_number;
453 $documentstatic->type = $objp->doc_type;
454 $documentstatic->fk_statut = $objp->status;
455 $documentstatic->fk_status = $objp->status;
456 $documentstatic->statut = $objp->status;
457 $documentstatic->status = $objp->status;
458 $documentstatic->paye = $objp->paid;
459 $documentstatic->paid = $objp->paid;
461 if (is_object($documentstaticline)) {
462 $documentstaticline->statut = $objp->status;
465 print
'<tr class="oddeven">';
466 print
'<td class="nobordernopadding nowrap" width="100">';
467 print $documentstatic->getNomUrl(1);
469 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
472 print
'<td class="center">';
473 if ($type_element ==
'contract') {
474 print $documentstaticline->getLibStatut(2);
476 print $documentstatic->getLibStatut(2);
483 $text =
''; $description =
''; $type = 0;
486 if ($objp->fk_product > 0) {
487 $product_static =
new Product($db);
489 $product_static->type = $objp->fk_product_type;
490 $product_static->id = $objp->fk_product;
491 $product_static->ref = $objp->ref;
492 $product_static->entity = $objp->pentity;
493 $text = $product_static->getNomUrl(1);
497 if ($objp->fk_product > 0) {
499 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
501 $prod->fetch($objp->fk_product);
503 $outputlangs = $langs;
505 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
506 $newlang =
GETPOST(
'lang_id',
'aZ09');
508 if (empty($newlang)) {
509 $newlang = $object->default_lang;
511 if (!empty($newlang)) {
513 $outputlangs->setDefaultLang($newlang);
516 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
518 $label = $objp->product_label;
521 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
525 if (($objp->info_bits & 2) == 2) {
526 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$object->id.
'">';
528 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
529 if ($objp->description ==
'(DEPOSIT)') {
530 $txt = $langs->trans(
"Deposit");
531 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
532 $txt = $langs->trans(
"ExcessReceived");
533 } elseif ($objp->description ==
'(EXCESS PAID)') {
534 $txt = $langs->trans(
"ExcessPaid");
539 if ($objp->description) {
540 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
542 $discount->fetch($objp->fk_remise_except);
543 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
545 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
547 $discount->fetch($objp->fk_remise_except);
548 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
549 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
551 $discount->fetch($objp->fk_remise_except);
552 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
553 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
555 $discount->fetch($objp->fk_remise_except);
556 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
558 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
559 echo
' ('.dol_print_date($discount->datec).
')';
562 echo ($txt ?
' - ' :
'').dol_htmlentitiesbr($objp->description);
566 if ($objp->fk_product > 0) {
567 echo
$form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
574 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
577 if (!empty($objp->label) || !empty($objp->description)) {
579 $text =
img_object($langs->trans(
'Service'),
'service');
581 $text =
img_object($langs->trans(
'Product'),
'product');
584 if (!empty($objp->label)) {
585 $text .=
' <strong>'.$objp->label.
'</strong>';
617 print
'<td>'.$objp->type_contact_label.
'</td>';
619 print
'<td class="right">'.$objp->prod_qty.
'</td>';
620 $total_qty += $objp->prod_qty;
622 print
'<td class="right">'.price($objp->total_ht).
'</td>';
623 $total_ht += $objp->total_ht;
625 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
631 print
'<tr class="liste_total">';
632 print
'<td>'.$langs->trans(
'Total').
'</td>';
633 print
'<td colspan="3"></td>';
635 print
'<td class="right">'.$total_qty.
'</td>';
636 print
'<td class="right">'.price($total_ht).
'</td>';
637 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
642 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
645 } elseif (empty($type_element) || $type_element == -1) {
646 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
648 print
'<table class="liste centpercent">'.
"\n";
650 print
'<tr class="liste_titre">';
651 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
652 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
653 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
655 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
658 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
662 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
664 print
'<table class="liste centpercent">'.
"\n";
666 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';