33require
"../main.inc.php";
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
47$optioncss =
GETPOST(
'optioncss',
'aZ');
48$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
50$action =
GETPOST(
'action',
'aZ');
57if (empty(
$object->thirdparty)) {
60$socid = !empty(
$object->thirdparty->id) ?
$object->thirdparty->id :
null;
64$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
71$offset = $limit * $page;
78 $sortfield =
'dateprint';
83$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
88if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
90 $sprod_fulldescr =
'';
95$thirdTypeSelect =
GETPOST(
"third_select_id");
96$type_element = GETPOSTISSET(
'type_element') ?
GETPOST(
'type_element') :
'';
99$langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
102$hookmanager->initHooks(array(
'consumptioncontact'));
111$parameters = array(
'id' => $id);
112$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
126$title = $langs->trans(
"ContactRelatedItems");
127$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
129llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-societe page-contact-card_consumption');
137print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ContactsAddresses"), -1,
'contact');
139$linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
141$morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.
$object->id.
'" class="refid">';
142$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
143$morehtmlref .=
'</a>';
145$morehtmlref .=
'<div class="refidno">';
147 $objsoc->fetch($socid);
149 if ($objsoc->id > 0) {
150 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
152 $morehtmlref .=
'<span class="opacitymedium">'.$langs->trans(
"ContactNotLinkedToCompany").
'</span>';
155$morehtmlref .=
'</div>';
157dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
159print
'<div class="fichecenter">';
161print
'<div class="underbanner clearboth"></div>';
162print
'<table class="border centpercent tableforfield">';
165print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
166print
$object->getCivilityLabel();
169$thirdTypeArray = array();
170$elementTypeArray = array();
172if (!empty(
$object->thirdparty->client)) {
173 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
174 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
175 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
177 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
178 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
180 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
181 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
183 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
184 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
188if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
189 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
192if (!empty(
$object->thirdparty->fournisseur)) {
193 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
194 if ((
isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
195 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
197 if ((
isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
198 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
213print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'">';
214print
'<input type="hidden" name="token" value="'.newToken().
'">';
216$documentstatic =
null;
217$documentstaticline =
null;
223if ($type_element ==
'fichinter') {
224 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
226 $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, ';
227 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
228 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
229 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
230 $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)";
231 $where =
' WHERE f.entity IN ('.getEntity(
'intervention').
')';
232 $dateprint =
'f.datec';
233 $doc_number =
'f.ref';
234} elseif ($type_element ==
'invoice') {
235 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
237 $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, ';
238 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
239 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
240 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
241 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
242 $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)";
243 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
244 $dateprint =
'f.datef';
245 $doc_number =
'f.ref';
246 $thirdTypeSelect =
'customer';
247} elseif ($type_element ==
'propal') {
248 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
250 $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, ';
251 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
252 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
253 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
254 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
255 $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)";
256 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
257 $dateprint =
'c.datep';
258 $doc_number =
'c.ref';
259 $thirdTypeSelect =
'customer';
260} elseif ($type_element ==
'order') {
261 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
263 $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, ';
264 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
265 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
266 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
267 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
268 $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)";
269 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
270 $dateprint =
'c.date_commande';
271 $doc_number =
'c.ref';
272 $thirdTypeSelect =
'customer';
273} elseif ($type_element ==
'supplier_invoice') {
274 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
276 $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, ';
277 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
278 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
279 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
280 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
281 $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)";
282 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
283 $dateprint =
'f.datef';
284 $doc_number =
'f.ref';
285 $thirdTypeSelect =
'supplier';
298} elseif ($type_element ==
'supplier_order') {
299 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
301 $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, ';
302 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
303 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
304 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
305 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
306 $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)";
307 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
308 $dateprint =
'c.date_valid';
309 $doc_number =
'c.ref';
310 $thirdTypeSelect =
'supplier';
311} elseif ($type_element ==
'contract') {
312 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
315 $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, ';
316 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
317 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
318 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
319 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
320 $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)";
321 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
322 $dateprint =
'c.date_valid';
323 $doc_number =
'c.ref';
324 $thirdTypeSelect =
'customer';
327$parameters = array();
330$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
332if (!empty($sql_select)) {
334 $sql .=
' d.description as description';
335 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
336 $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, ';
338 if ($type_element ==
'supplier_proposal') {
339 $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, ';
341 if ($type_element ==
'contract') {
342 $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, ';
344 if ($type_element !=
'fichinter') {
345 $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';
348 if ($type_element !=
'fichinter') {
349 $sql .=
", p.ref as prod_ref, p.label as product_label";
351 $sanitizedtablefrom = $tables_from;
352 $sql .=
" FROM ".$sanitizedtablefrom;
353 $sanitizedwhere = $where;
354 $sql .= $sanitizedwhere;
356 if ($sref && !empty($doc_number)) {
357 $sql .=
" AND ".$db->sanitize($doc_number).
" LIKE '%".
$db->escape($sref).
"%'";
359 if ($sprod_fulldescr) {
360 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
361 if (
GETPOST(
'type_element') !=
'fichinter') {
362 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
364 if (
GETPOST(
'type_element') !=
'fichinter') {
365 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
369 $parameters = array(
'type_element' => $type_element);
370 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
371 $sql .= $hookmanager->resPrint;
372 $sql .=
$db->order($sortfield, $sortorder);
374 $resql =
$db->query($sql);
378 $totalnboflines =
$db->num_rows($resql);
380 $sql .=
$db->plimit($limit + 1, $offset);
385if (empty($elementTypeArray) && !
$object->thirdparty->client && !
$object->thirdparty->fournisseur) {
386 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
391$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
392$button =
'<input type="submit" class="button small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
395$param .=
"&sref=".urlencode($sref);
396$param .=
"&month=".urlencode($month);
397$param .=
"&year=".urlencode($year);
398$param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
400 $param .=
"&socid=".urlencode((
string) ($socid));
402$param .=
"&type_element=".urlencode($type_element);
406if ($sql_select && $documentstatic !==
null) {
407 $resql =
$db->query($sql);
412 $num =
$db->num_rows($resql);
414 $param = (!empty($socid) ?
"&socid=".urlencode((
string) ($socid)) :
"").
"&type_element=".urlencode((
string) ($type_element)).
"&id=".urlencode((
string) ($id));
415 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
416 $param .=
'&contextpage='.urlencode($contextpage);
418 if ($limit > 0 && $limit !=
$conf->liste_limit) {
419 $param .=
'&limit='.((int) $limit);
421 if ($sprod_fulldescr) {
422 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
425 $param .=
"&sref=".urlencode($sref);
428 $param .=
"&month=".urlencode((
string) ($month));
431 $param .=
"&year=".urlencode((
string) ($year));
433 if ($optioncss !=
'') {
434 $param .=
'&optioncss='.urlencode($optioncss);
437 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'nogreyscale', $limit);
439 print
'<div class="div-table-responsive-no-min">';
440 print
'<table class="liste centpercent">'.
"\n";
443 print
'<tr class="liste_titre">';
444 print
'<td class="liste_titre left">';
445 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
447 print
'<td class="liste_titre nowrap center">';
448 print $formother->select_month($month ? (
string) $month :
'-1',
'month', 1, 0,
'valignmiddle');
449 print $formother->selectyear($year ? (
string) $year :
'-1',
'year', 1, 20, 1);
451 print
'<td class="liste_titre center">';
453 print
'<td class="liste_titre left">';
454 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
456 print
'<td class="liste_titre center">';
458 print
'<td class="liste_titre center">';
460 print
'<td class="liste_titre center">';
462 print
'<td class="liste_titre maxwidthsearch">';
463 $searchpicto = $form->showFilterAndCheckAddButtons(0);
469 print
'<tr class="liste_titre">';
470 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
471 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
472 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
474 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
475 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
476 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
477 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
484 while (($objp =
$db->fetch_object($resql)) && $i < min($num, $limit)) {
485 $documentstatic->id = $objp->doc_id;
486 $documentstatic->ref = $objp->doc_number;
487 $documentstatic->type = $objp->doc_type;
489 $documentstatic->fk_statut = $objp->status;
490 $documentstatic->statut = $objp->status;
491 $documentstatic->status = $objp->status;
492 if ($type_element ==
'invoice' || $type_element ==
'supplier_invoice') {
493 $documentstatic->paye = $objp->paid;
494 $documentstatic->paid = $objp->paid;
497 if (is_object($documentstaticline)) {
498 $documentstaticline->statut = $objp->status;
501 print
'<tr class="oddeven">';
502 print
'<td class="nobordernopadding nowrap" width="100">';
503 print $documentstatic->getNomUrl(1);
505 print
'<td class="center" width="80">'.dol_print_date(
$db->jdate($objp->dateprint),
'day').
'</td>';
508 print
'<td class="center">';
509 if ($type_element ==
'contract') {
510 print $documentstaticline->getLibStatut(2);
512 print $documentstatic->getLibStatut(2);
524 if ($objp->fk_product > 0) {
527 $product_static->type = $objp->fk_product_type;
528 $product_static->id = $objp->fk_product;
529 $product_static->ref = $objp->ref;
530 $product_static->entity = $objp->pentity;
531 $text = $product_static->getNomUrl(1);
535 if ($objp->fk_product > 0) {
539 $prod->fetch($objp->fk_product);
541 $outputlangs = $langs;
543 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
544 $newlang =
GETPOST(
'lang_id',
'aZ09');
546 if (empty($newlang)) {
547 $newlang =
$object->default_lang;
549 if (!empty($newlang)) {
551 $outputlangs->setDefaultLang($newlang);
554 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"label"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
556 $label = $objp->product_label;
559 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
563 if (($objp->info_bits & 2) == 2) {
564 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.
$object->id.
'">';
566 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
567 if ($objp->description ==
'(DEPOSIT)') {
568 $txt = $langs->trans(
"Deposit");
569 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
570 $txt = $langs->trans(
"ExcessReceived");
571 } elseif ($objp->description ==
'(EXCESS PAID)') {
572 $txt = $langs->trans(
"ExcessPaid");
577 if ($objp->description) {
578 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
580 $discount->fetch($objp->fk_remise_except);
581 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
583 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
585 $discount->fetch($objp->fk_remise_except);
586 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
587 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
589 $discount->fetch($objp->fk_remise_except);
590 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
591 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
593 $discount->fetch($objp->fk_remise_except);
594 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
597 echo
' ('.dol_print_date($discount->datec).
')';
604 if ($objp->fk_product > 0) {
605 echo $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i, 0,
'');
612 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
615 if (!empty($objp->label) || !empty($objp->description)) {
617 $text =
img_object($langs->trans(
'Service'),
'service');
619 $text =
img_object($langs->trans(
'Product'),
'product');
622 if (!empty($objp->label)) {
623 $text .=
' <strong>'.$objp->label.
'</strong>';
624 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3, 0,
'', (
string) $i, 0,
'');
655 print
'<td>'.$objp->type_contact_label.
'</td>';
657 print
'<td class="right">'.$objp->prod_qty.
'</td>';
658 $total_qty += $objp->prod_qty;
660 print
'<td class="right">'.price($objp->total_ht).
'</td>';
661 $total_ht += $objp->total_ht;
663 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
669 print
'<tr class="liste_total">';
670 print
'<td>'.$langs->trans(
'Total').
'</td>';
671 print
'<td colspan="3"></td>';
673 print
'<td class="right">'.$total_qty.
'</td>';
674 print
'<td class="right">'.price($total_ht).
'</td>';
675 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
680 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
683} elseif (empty($type_element) || $type_element == -1) {
684 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
686 print
'<table class="liste centpercent">'.
"\n";
688 print
'<tr class="liste_titre">';
689 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
690 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
691 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
693 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
696 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
700 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
702 print
'<table class="liste centpercent">'.
"\n";
704 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage predefined suppliers products.
Class to manage customers orders.
Class to manage lines of contracts.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage products or services.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
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).
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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)
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
get_date_range($date_start, $date_end, $format='', $outputlangs=null, $withparenthesis=1)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.