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)) {
49$socid = !empty(
$object->thirdparty->id) ?
$object->thirdparty->id :
null;
53$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
56if (empty($page) || $page == -1) {
59$offset = $limit * $page;
66 $sortfield =
'dateprint';
71$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
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'));
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 = $langs->trans(
"ContactRelatedItems");
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">';
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();
156$thirdTypeArray = array();
157$elementTypeArray = array();
159if (!empty(
$object->thirdparty->client)) {
160 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
161 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
162 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
164 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
165 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
167 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
168 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
170 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
171 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
175if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
176 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
179if (!empty(
$object->thirdparty->fournisseur)) {
180 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
181 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
182 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
184 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
185 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
200print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
201print
'<input type="hidden" name="token" value="'.newToken().
'">';
204if ($type_element ==
'fichinter') {
205 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
207 $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, ';
208 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
209 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
210 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
211 $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)";
212 $where =
' WHERE f.entity IN ('.getEntity(
'intervention').
')';
213 $dateprint =
'f.datec';
214 $doc_number =
'f.ref';
215} elseif ($type_element ==
'invoice') {
216 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
217 $documentstatic =
new Facture($db);
218 $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, ';
219 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
220 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
221 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
222 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
223 $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)";
224 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
225 $dateprint =
'f.datef';
226 $doc_number =
'f.ref';
227 $thirdTypeSelect =
'customer';
228} elseif ($type_element ==
'propal') {
229 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
230 $documentstatic =
new Propal($db);
231 $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, ';
232 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
233 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
234 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
235 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
236 $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)";
237 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
238 $dateprint =
'c.datep';
239 $doc_number =
'c.ref';
240 $thirdTypeSelect =
'customer';
241} elseif ($type_element ==
'order') {
242 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
243 $documentstatic =
new Commande($db);
244 $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, ';
245 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
246 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
247 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
248 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
249 $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)";
250 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
251 $dateprint =
'c.date_commande';
252 $doc_number =
'c.ref';
253 $thirdTypeSelect =
'customer';
254} elseif ($type_element ==
'supplier_invoice') {
255 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
257 $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, ';
258 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
259 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
260 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
261 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
262 $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)";
263 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
264 $dateprint =
'f.datef';
265 $doc_number =
'f.ref';
266 $thirdTypeSelect =
'supplier';
279} elseif ($type_element ==
'supplier_order') {
280 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
282 $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, ';
283 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
284 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
285 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
286 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
287 $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)";
288 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
289 $dateprint =
'c.date_valid';
290 $doc_number =
'c.ref';
291 $thirdTypeSelect =
'supplier';
292} elseif ($type_element ==
'contract') {
293 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
294 $documentstatic =
new Contrat($db);
296 $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, ';
297 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
298 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
299 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
300 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
301 $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)";
302 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
303 $dateprint =
'c.date_valid';
304 $doc_number =
'c.ref';
305 $thirdTypeSelect =
'customer';
308$parameters = array();
309$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
311if (!empty($sql_select)) {
313 $sql .=
' d.description as description';
314 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
315 $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, ';
317 if ($type_element ==
'supplier_proposal') {
318 $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, ';
320 if ($type_element ==
'contract') {
321 $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, ';
323 if ($type_element !=
'fichinter') {
324 $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';
327 if ($type_element !=
'fichinter') {
328 $sql .=
", p.ref as prod_ref, p.label as product_label";
330 $sql .=
" FROM ".$tables_from;
335 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
337 if ($sprod_fulldescr) {
338 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
339 if (
GETPOST(
'type_element') !=
'fichinter') {
340 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
342 if (
GETPOST(
'type_element') !=
'fichinter') {
343 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
347 $sql .= $db->order($sortfield, $sortorder);
348 $resql = $db->query($sql);
349 $totalnboflines = $db->num_rows($resql);
351 $sql .= $db->plimit($limit + 1, $offset);
356if (empty($elementTypeArray) && !
$object->thirdparty->client && !
$object->thirdparty->fournisseur) {
357 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
362$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
363$button =
'<input type="submit" class="button small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
366$param .=
"&sref=".urlencode($sref);
367$param .=
"&month=".urlencode($month);
368$param .=
"&year=".urlencode($year);
369$param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
371 $param .=
"&socid=".urlencode((
string) ($socid));
373$param .=
"&type_element=".urlencode($type_element);
378 $resql = $db->query($sql);
383 $num = $db->num_rows($resql);
385 $param = (!empty($socid) ?
"&socid=".urlencode((
string) ($socid)) :
"").
"&type_element=".urlencode((
string) ($type_element)).
"&id=".urlencode((
string) ($id));
386 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
387 $param .=
'&contextpage='.urlencode($contextpage);
389 if ($limit > 0 && $limit != $conf->liste_limit) {
390 $param .=
'&limit='.((int) $limit);
392 if ($sprod_fulldescr) {
393 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
396 $param .=
"&sref=".urlencode($sref);
399 $param .=
"&month=".urlencode((
string) ($month));
402 $param .=
"&year=".urlencode((
string) ($year));
404 if ($optioncss !=
'') {
405 $param .=
'&optioncss='.urlencode($optioncss);
408 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
410 print
'<div class="div-table-responsive-no-min">';
411 print
'<table class="liste centpercent">'.
"\n";
414 print
'<tr class="liste_titre">';
415 print
'<td class="liste_titre left">';
416 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
418 print
'<td class="liste_titre nowrap center">';
419 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
420 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1);
422 print
'<td class="liste_titre center">';
424 print
'<td class="liste_titre left">';
425 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
427 print
'<td class="liste_titre center">';
429 print
'<td class="liste_titre center">';
431 print
'<td class="liste_titre center">';
433 print
'<td class="liste_titre maxwidthsearch">';
434 $searchpicto = $form->showFilterAndCheckAddButtons(0);
440 print
'<tr class="liste_titre">';
441 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
442 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
443 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
445 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
446 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
447 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
448 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
455 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
456 $documentstatic->id = $objp->doc_id;
457 $documentstatic->ref = $objp->doc_number;
458 $documentstatic->type = $objp->doc_type;
460 $documentstatic->fk_statut = $objp->status;
461 $documentstatic->statut = $objp->status;
462 $documentstatic->status = $objp->status;
464 $documentstatic->paye = $objp->paid;
465 $documentstatic->paid = $objp->paid;
467 if (is_object($documentstaticline)) {
468 $documentstaticline->statut = $objp->status;
471 print
'<tr class="oddeven">';
472 print
'<td class="nobordernopadding nowrap" width="100">';
473 print $documentstatic->getNomUrl(1);
475 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
478 print
'<td class="center">';
479 if ($type_element ==
'contract') {
480 print $documentstaticline->getLibStatut(2);
482 print $documentstatic->getLibStatut(2);
494 if ($objp->fk_product > 0) {
495 $product_static =
new Product($db);
497 $product_static->type = $objp->fk_product_type;
498 $product_static->id = $objp->fk_product;
499 $product_static->ref = $objp->ref;
500 $product_static->entity = $objp->pentity;
501 $text = $product_static->getNomUrl(1);
505 if ($objp->fk_product > 0) {
509 $prod->fetch($objp->fk_product);
511 $outputlangs = $langs;
513 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
514 $newlang =
GETPOST(
'lang_id',
'aZ09');
516 if (empty($newlang)) {
517 $newlang =
$object->default_lang;
519 if (!empty($newlang)) {
521 $outputlangs->setDefaultLang($newlang);
524 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
526 $label = $objp->product_label;
529 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
533 if (($objp->info_bits & 2) == 2) {
534 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.
$object->id.
'">';
536 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
537 if ($objp->description ==
'(DEPOSIT)') {
538 $txt = $langs->trans(
"Deposit");
539 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
540 $txt = $langs->trans(
"ExcessReceived");
541 } elseif ($objp->description ==
'(EXCESS PAID)') {
542 $txt = $langs->trans(
"ExcessPaid");
547 if ($objp->description) {
548 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
550 $discount->fetch($objp->fk_remise_except);
551 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
553 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
555 $discount->fetch($objp->fk_remise_except);
556 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
557 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
559 $discount->fetch($objp->fk_remise_except);
560 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
561 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
563 $discount->fetch($objp->fk_remise_except);
564 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
567 echo
' ('.dol_print_date($discount->datec).
')';
574 if ($objp->fk_product > 0) {
575 echo $form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
582 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
585 if (!empty($objp->label) || !empty($objp->description)) {
587 $text =
img_object($langs->trans(
'Service'),
'service');
589 $text =
img_object($langs->trans(
'Product'),
'product');
592 if (!empty($objp->label)) {
593 $text .=
' <strong>'.$objp->label.
'</strong>';
594 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3,
'',
'', $i, 0,
'');
625 print
'<td>'.$objp->type_contact_label.
'</td>';
627 print
'<td class="right">'.$objp->prod_qty.
'</td>';
628 $total_qty += $objp->prod_qty;
630 print
'<td class="right">'.price($objp->total_ht).
'</td>';
631 $total_ht += $objp->total_ht;
633 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
639 print
'<tr class="liste_total">';
640 print
'<td>'.$langs->trans(
'Total').
'</td>';
641 print
'<td colspan="3"></td>';
643 print
'<td class="right">'.$total_qty.
'</td>';
644 print
'<td class="right">'.price($total_ht).
'</td>';
645 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
650 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
653} elseif (empty($type_element) || $type_element == -1) {
654 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
656 print
'<table class="liste centpercent">'.
"\n";
658 print
'<tr class="liste_titre">';
659 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
660 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
661 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
663 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
666 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
670 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
672 print
'<table class="liste centpercent">'.
"\n";
674 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
get_date_range($date_start, $date_end, $format='', $outputlangs=null, $withparenthesis=1)
Format output for start and end date.
print_barre_liste($title, $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.
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.
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 dolibarr global constant string value.
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.