31require
"../main.inc.php";
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
38$optioncss =
GETPOST(
'optioncss',
'aZ');
39$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
47if (empty(
$object->thirdparty)) {
50$socid = !empty(
$object->thirdparty->id) ?
$object->thirdparty->id :
null;
54$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
55$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
57if (empty($page) || $page == -1) {
60$offset = $limit * $page;
67 $sortfield =
'dateprint';
72$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
77if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
79 $sprod_fulldescr =
'';
84$thirdTypeSelect =
GETPOST(
"third_select_id");
85$type_element = GETPOSTISSET(
'type_element') ?
GETPOST(
'type_element') :
'';
88$langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
91$hookmanager->initHooks(array(
'consumptioncontact'));
100$parameters = array(
'id' => $id);
101$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110$form =
new Form($db);
112$productstatic =
new Product($db);
115$title = $langs->trans(
"ContactRelatedItems");
116$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
118llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-societe page-contact-card_consumption');
126print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ContactsAddresses"), -1,
'contact');
128$linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
130$morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.
$object->id.
'" class="refid">';
131$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
132$morehtmlref .=
'</a>';
134$morehtmlref .=
'<div class="refidno">';
136 $objsoc->fetch($socid);
138 if ($objsoc->id > 0) {
139 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
141 $morehtmlref .=
'<span class="opacitymedium">'.$langs->trans(
"ContactNotLinkedToCompany").
'</span>';
144$morehtmlref .=
'</div>';
146dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
148print
'<div class="fichecenter">';
150print
'<div class="underbanner clearboth"></div>';
151print
'<table class="border centpercent tableforfield">';
154print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
155print
$object->getCivilityLabel();
158$thirdTypeArray = array();
159$elementTypeArray = array();
161if (!empty(
$object->thirdparty->client)) {
162 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
163 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
164 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
166 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
167 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
169 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
170 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
172 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
173 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
177if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
178 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
181if (!empty(
$object->thirdparty->fournisseur)) {
182 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
183 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
184 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
186 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
187 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
202print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
203print
'<input type="hidden" name="token" value="'.newToken().
'">';
206if ($type_element ==
'fichinter') {
207 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
209 $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, ';
210 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
211 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
212 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
213 $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)";
214 $where =
' WHERE f.entity IN ('.getEntity(
'intervention').
')';
215 $dateprint =
'f.datec';
216 $doc_number =
'f.ref';
217} elseif ($type_element ==
'invoice') {
218 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
219 $documentstatic =
new Facture($db);
220 $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, ';
221 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
222 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
223 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
224 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
225 $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)";
226 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
227 $dateprint =
'f.datef';
228 $doc_number =
'f.ref';
229 $thirdTypeSelect =
'customer';
230} elseif ($type_element ==
'propal') {
231 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
232 $documentstatic =
new Propal($db);
233 $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, ';
234 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
235 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
236 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
237 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
238 $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)";
239 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
240 $dateprint =
'c.datep';
241 $doc_number =
'c.ref';
242 $thirdTypeSelect =
'customer';
243} elseif ($type_element ==
'order') {
244 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
245 $documentstatic =
new Commande($db);
246 $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, ';
247 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
248 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
249 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
250 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
251 $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)";
252 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
253 $dateprint =
'c.date_commande';
254 $doc_number =
'c.ref';
255 $thirdTypeSelect =
'customer';
256} elseif ($type_element ==
'supplier_invoice') {
257 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
259 $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, ';
260 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
261 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
262 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
263 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int)
$object->id);
264 $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)";
265 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
266 $dateprint =
'f.datef';
267 $doc_number =
'f.ref';
268 $thirdTypeSelect =
'supplier';
281} elseif ($type_element ==
'supplier_order') {
282 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
284 $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, ';
285 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
286 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
287 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
288 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
289 $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)";
290 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
291 $dateprint =
'c.date_valid';
292 $doc_number =
'c.ref';
293 $thirdTypeSelect =
'supplier';
294} elseif ($type_element ==
'contract') {
295 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
296 $documentstatic =
new Contrat($db);
298 $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, ';
299 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
300 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
301 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
302 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int)
$object->id);
303 $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)";
304 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
305 $dateprint =
'c.date_valid';
306 $doc_number =
'c.ref';
307 $thirdTypeSelect =
'customer';
310$parameters = array();
311$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
313if (!empty($sql_select)) {
315 $sql .=
' d.description as description';
316 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
317 $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, ';
319 if ($type_element ==
'supplier_proposal') {
320 $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, ';
322 if ($type_element ==
'contract') {
323 $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, ';
325 if ($type_element !=
'fichinter') {
326 $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';
329 if ($type_element !=
'fichinter') {
330 $sql .=
", p.ref as prod_ref, p.label as product_label";
332 $sql .=
" FROM ".$tables_from;
337 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
339 if ($sprod_fulldescr) {
340 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
341 if (
GETPOST(
'type_element') !=
'fichinter') {
342 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
344 if (
GETPOST(
'type_element') !=
'fichinter') {
345 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
349 $sql .= $db->order($sortfield, $sortorder);
350 $resql = $db->query($sql);
351 $totalnboflines = $db->num_rows($resql);
353 $sql .= $db->plimit($limit + 1, $offset);
358if (empty($elementTypeArray) && !
$object->thirdparty->client && !
$object->thirdparty->fournisseur) {
359 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
364$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
365$button =
'<input type="submit" class="button small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
368$param .=
"&sref=".urlencode($sref);
369$param .=
"&month=".urlencode($month);
370$param .=
"&year=".urlencode($year);
371$param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
373 $param .=
"&socid=".urlencode((
string) ($socid));
375$param .=
"&type_element=".urlencode($type_element);
380 $resql = $db->query($sql);
385 $num = $db->num_rows($resql);
387 $param = (!empty($socid) ?
"&socid=".urlencode((
string) ($socid)) :
"").
"&type_element=".urlencode((
string) ($type_element)).
"&id=".urlencode((
string) ($id));
388 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
389 $param .=
'&contextpage='.urlencode($contextpage);
391 if ($limit > 0 && $limit != $conf->liste_limit) {
392 $param .=
'&limit='.((int) $limit);
394 if ($sprod_fulldescr) {
395 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
398 $param .=
"&sref=".urlencode($sref);
401 $param .=
"&month=".urlencode((
string) ($month));
404 $param .=
"&year=".urlencode((
string) ($year));
406 if ($optioncss !=
'') {
407 $param .=
'&optioncss='.urlencode($optioncss);
410 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
412 print
'<div class="div-table-responsive-no-min">';
413 print
'<table class="liste centpercent">'.
"\n";
416 print
'<tr class="liste_titre">';
417 print
'<td class="liste_titre left">';
418 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
420 print
'<td class="liste_titre nowrap center">';
421 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
422 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1);
424 print
'<td class="liste_titre center">';
426 print
'<td class="liste_titre left">';
427 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
429 print
'<td class="liste_titre center">';
431 print
'<td class="liste_titre center">';
433 print
'<td class="liste_titre center">';
435 print
'<td class="liste_titre maxwidthsearch">';
436 $searchpicto = $form->showFilterAndCheckAddButtons(0);
442 print
'<tr class="liste_titre">';
443 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
444 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
445 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
447 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
448 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
449 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
450 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
457 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
458 $documentstatic->id = $objp->doc_id;
459 $documentstatic->ref = $objp->doc_number;
460 $documentstatic->type = $objp->doc_type;
462 $documentstatic->fk_statut = $objp->status;
463 $documentstatic->statut = $objp->status;
464 $documentstatic->status = $objp->status;
466 $documentstatic->paye = $objp->paid;
467 $documentstatic->paid = $objp->paid;
469 if (is_object($documentstaticline)) {
470 $documentstaticline->statut = $objp->status;
473 print
'<tr class="oddeven">';
474 print
'<td class="nobordernopadding nowrap" width="100">';
475 print $documentstatic->getNomUrl(1);
477 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
480 print
'<td class="center">';
481 if ($type_element ==
'contract') {
482 print $documentstaticline->getLibStatut(2);
484 print $documentstatic->getLibStatut(2);
496 if ($objp->fk_product > 0) {
497 $product_static =
new Product($db);
499 $product_static->type = $objp->fk_product_type;
500 $product_static->id = $objp->fk_product;
501 $product_static->ref = $objp->ref;
502 $product_static->entity = $objp->pentity;
503 $text = $product_static->getNomUrl(1);
507 if ($objp->fk_product > 0) {
511 $prod->fetch($objp->fk_product);
513 $outputlangs = $langs;
515 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
516 $newlang =
GETPOST(
'lang_id',
'aZ09');
518 if (empty($newlang)) {
519 $newlang =
$object->default_lang;
521 if (!empty($newlang)) {
523 $outputlangs->setDefaultLang($newlang);
526 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
528 $label = $objp->product_label;
531 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
535 if (($objp->info_bits & 2) == 2) {
536 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.
$object->id.
'">';
538 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
539 if ($objp->description ==
'(DEPOSIT)') {
540 $txt = $langs->trans(
"Deposit");
541 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
542 $txt = $langs->trans(
"ExcessReceived");
543 } elseif ($objp->description ==
'(EXCESS PAID)') {
544 $txt = $langs->trans(
"ExcessPaid");
549 if ($objp->description) {
550 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
552 $discount->fetch($objp->fk_remise_except);
553 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
555 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
557 $discount->fetch($objp->fk_remise_except);
558 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
559 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
561 $discount->fetch($objp->fk_remise_except);
562 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
563 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
565 $discount->fetch($objp->fk_remise_except);
566 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
569 echo
' ('.dol_print_date($discount->datec).
')';
576 if ($objp->fk_product > 0) {
577 echo $form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
584 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
587 if (!empty($objp->label) || !empty($objp->description)) {
589 $text =
img_object($langs->trans(
'Service'),
'service');
591 $text =
img_object($langs->trans(
'Product'),
'product');
594 if (!empty($objp->label)) {
595 $text .=
' <strong>'.$objp->label.
'</strong>';
596 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3,
'',
'', $i, 0,
'');
627 print
'<td>'.$objp->type_contact_label.
'</td>';
629 print
'<td class="right">'.$objp->prod_qty.
'</td>';
630 $total_qty += $objp->prod_qty;
632 print
'<td class="right">'.price($objp->total_ht).
'</td>';
633 $total_ht += $objp->total_ht;
635 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
641 print
'<tr class="liste_total">';
642 print
'<td>'.$langs->trans(
'Total').
'</td>';
643 print
'<td colspan="3"></td>';
645 print
'<td class="right">'.$total_qty.
'</td>';
646 print
'<td class="right">'.price($total_ht).
'</td>';
647 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
652 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
655} elseif (empty($type_element) || $type_element == -1) {
656 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
658 print
'<table class="liste centpercent">'.
"\n";
660 print
'<tr class="liste_titre">';
661 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
662 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
663 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
665 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
668 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
672 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
674 print
'<table class="liste centpercent">'.
"\n";
676 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($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 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.