/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $user, $langs, $db, $conf; $this->max = $max; $thirdpartystatic = new Client($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $max)); if ($user->rights->societe->lire) { $sql = "SELECT s.nom as name, s.rowid as socid"; $sql .= ", s.code_client"; $sql .= ", s.client"; $sql .= ", s.code_fournisseur"; $sql .= ", s.fournisseur"; $sql .= ", s.logo"; $sql .= ", s.fk_stcomm, s.datec, s.tms, s.status"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE s.client IN (2, 3)"; $sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id; } $sql .= " ORDER BY s.tms DESC"; $sql .= $db->plimit($max, 0); dol_syslog(get_class($this) . "::loadBox", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $line = 0; while ($line < $num) { $objp = $db->fetch_object($resql); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->client = $objp->client; $thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->logo = $objp->logo; $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1); $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => str_replace('img ', 'img height="14" ', $thirdpartystatic->LibProspCommStatut($objp->fk_stcomm, 3))); $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3)); $line++; } if ($num == 0) { $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProspects")); } $db->free($resql); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
foreach ($extrafields->attribute_list as $key => $val) { if ($val) { print '<td>'; $paramkey = 'options_' . $key; print $extrafields->showOutputField($key, $obj->{$paramkey}); print '</td>'; } } } // Hook fields $parameters = array('obj' => $obj); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '<td align="right">'; print $prospectstatic->LibStatut($prospectstatic->status, 5); print '</td>'; print '<td></td>'; print "</tr>\n"; $i++; } if ($num > $conf->liste_limit || $page > 0) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); } print "</table>"; print "</form>"; $db->free($resql); $parameters = array('sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint;