34 global $db, $langs, $conf, $user;
35 $langs->loadLangs(array(
'propal',
'compta',
'companies'));
40 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/card.php?id='.$object->id;
41 $head[$h][1] = $langs->trans(
'Proposal');
42 $head[$h][2] =
'comm';
45 if ((empty($conf->commande->enabled) && ((isModEnabled(
"expedition") &&
getDolGlobalInt(
'MAIN_SUBMODULE_EXPEDITION') && $user->rights->expedition->lire)
46 || (isModEnabled(
"expedition") &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->rights->expedition->delivery->lire)))) {
47 $langs->load(
"sendings");
49 $head[$h][0] = DOL_URL_ROOT.
'/expedition/propal.php?id='.$object->id;
51 $text = $langs->trans(
"Shipment");
57 $text .= $langs->trans(
"Receivings");
60 $head[$h][2] =
'shipping';
64 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
65 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
66 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/contact.php?id='.$object->id;
67 $head[$h][1] = $langs->trans(
'ContactsAddresses');
69 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
71 $head[$h][2] =
'contact';
81 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
83 if (!empty($object->note_private)) {
86 if (!empty($object->note_public)) {
89 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/note.php?id='.$object->id;
90 $head[$h][1] = $langs->trans(
'Notes');
92 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
94 $head[$h][2] =
'note';
98 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
99 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
100 $upload_dir = $conf->propal->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
101 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
102 $nbLinks =
Link::count($db, $object->element, $object->id);
103 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/document.php?id='.$object->id;
104 $head[$h][1] = $langs->trans(
'Documents');
105 if (($nbFiles + $nbLinks) > 0) {
106 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
108 $head[$h][2] =
'document';
112 $head[$h][0] = DOL_URL_ROOT.
'/comm/propal/agenda.php?id='.$object->id;
113 $head[$h][1] = $langs->trans(
"Events");
114 if (isModEnabled(
'agenda')&& ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
117 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
118 $cachekey =
'count_events_propal_'.$object->id;
120 if (!is_null($dataretrieved)) {
121 $nbEvent = $dataretrieved;
123 $sql =
"SELECT COUNT(id) as nb";
124 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
125 $sql .=
" WHERE fk_element = ".((int) $object->id);
126 $sql .=
" AND elementtype = 'propal'";
127 $resql = $db->query($sql);
129 $obj = $db->fetch_object($resql);
132 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
138 $head[$h][1] .= $langs->trans(
"Agenda");
140 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
143 $head[$h][2] =
'agenda';
160 global $langs, $conf, $user, $db;
163 $extrafields->fetch_name_optionals_label(
'propal');
164 $extrafields->fetch_name_optionals_label(
'propaldet');
169 $head[$h][0] = DOL_URL_ROOT.
'/admin/propal.php';
170 $head[$h][1] = $langs->trans(
"Miscellaneous");
171 $head[$h][2] =
'general';
180 $head[$h][0] = DOL_URL_ROOT.
'/comm/admin/propal_extrafields.php';
181 $head[$h][1] = $langs->trans(
"ExtraFields");
182 $nbExtrafields = $extrafields->attributes[
'propal'][
'count'];
183 if ($nbExtrafields > 0) {
184 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
186 $head[$h][2] =
'attributes';
189 $head[$h][0] = DOL_URL_ROOT.
'/comm/admin/propaldet_extrafields.php';
190 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
191 $nbExtrafields = $extrafields->attributes[
'propaldet'][
'count'];
192 if ($nbExtrafields > 0) {
193 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
195 $head[$h][2] =
'attributeslines';
213 global $conf, $db, $langs, $user;
217 if (!isModEnabled(
'propal') || empty($user->rights->propal->lire)) {
223 $propalstatic =
new Propal($db);
225 $sql =
"SELECT count(p.rowid) as nb, p.fk_statut as status";
226 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
227 $sql .=
", ".MAIN_DB_PREFIX.
"propal as p";
228 if (empty($user->rights->societe->client->voir) && !$socid) {
229 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
231 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
232 $sql .=
" AND p.fk_soc = s.rowid";
234 $sql .=
' AND p.fk_soc = '.((int) $user->socid);
236 if (empty($user->rights->societe->client->voir) && !$socid) {
237 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
239 $sql .=
" AND p.fk_statut IN (".$db->sanitize(implode(
" ,", $listofstatus)).
")";
240 $sql .=
" GROUP BY p.fk_statut";
241 $resql = $db->query($sql);
243 $num = $db->num_rows($resql);
247 $dataseries = array();
248 $colorseries = array();
252 $obj = $db->fetch_object($resql);
254 $vals[$obj->status] = $obj->nb;
255 $totalinprocess += $obj->nb;
263 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
265 $result =
'<div class="div-table-responsive-no-min">';
266 $result .=
'<table class="noborder nohover centpercent">';
268 $result .=
'<tr class="liste_titre">';
269 $result .=
'<td colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"Proposals").
'</td>';
272 foreach ($listofstatus as $status) {
273 $dataseries[] = array($propalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
275 $colorseries[$status] =
'-'.$badgeStatus0;
278 $colorseries[$status] = $badgeStatus1;
281 $colorseries[$status] = $badgeStatus4;
284 $colorseries[$status] = $badgeStatus9;
287 $colorseries[$status] = $badgeStatus6;
290 if (empty($conf->use_javascript_ajax)) {
291 $result .=
'<tr class="oddeven">';
292 $result .=
'<td>'.$propalstatic->LibStatut($status, 0).
'</td>';
293 $result .=
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
294 $result .=
"</tr>\n";
298 if ($conf->use_javascript_ajax) {
300 $result .=
'<td align="center" colspan="2">';
302 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
304 $dolgraph->SetData($dataseries);
305 $dolgraph->SetDataColor(array_values($colorseries));
306 $dolgraph->setShowLegend(2);
307 $dolgraph->setShowPercent(1);
308 $dolgraph->SetType(array(
'pie'));
309 $dolgraph->setHeight(
'150');
310 $dolgraph->setWidth(
'300');
311 $dolgraph->draw(
'idgraphthirdparties');
312 $result .= $dolgraph->show($total ? 0 : 1);
326 $result .=
'<tr class="liste_total">';
327 $result .=
'<td>'.$langs->trans(
"Total").
'</td>';
328 $result .=
'<td class="right">'.$total.
'</td>';
331 $result .=
'</table>';
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.