30require
"../main.inc.php";
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
35require_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'));
46if (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');
55$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
56if (empty($page) || $page == -1) {
59$offset = $limit * $page;
66 $sortfield =
'dateprint';
71$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
72$month =
GETPOST(
'month',
'int');
76if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
78 $sprod_fulldescr =
'';
83$thirdTypeSelect =
GETPOST(
"third_select_id");
84$type_element = GETPOSTISSET(
'type_element') ?
GETPOST(
'type_element') :
'';
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);
109$form =
new Form($db);
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';
124print
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">';
133if (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>';
144dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
146print
'<div class="fichecenter">';
148print
'<div class="underbanner clearboth"></div>';
149print
'<table class="border centpercent tableforfield">';
152print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
153print $object->getCivilityLabel();
156if ($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');
172if (isModEnabled(
'ficheinter') && $user->hasRight(
'ficheinter',
'lire')) {
173 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
176if ($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');
197print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
198print
'<input type="hidden" name="token" value="'.newToken().
'">';
201if ($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(
'intervention').
')';
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);
308if (!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);
353if (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).
')';
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>';
586 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3,
'',
'', $i, 0,
'');
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>';
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.
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.
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='', $dragdropfile=0)
Show tabs of a record.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
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...
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.