dolibarr 21.0.0-beta
knowledgemanagementindex.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
6 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
32
41// Load translation files required by the page
42$langs->loadLangs(array("knowledgemanagement"));
43
44$action = GETPOST('action', 'aZ09');
45
46
47// Security check
48// if (! $user->rights->knowledgemanagement->myobject->read) {
49// accessforbidden();
50// }
51$socid = GETPOSTINT('socid');
52if (!empty($user->socid) && $user->socid > 0) {
53 $action = '';
54 $socid = $user->socid;
55}
56
57$max = 5;
58$now = dol_now();
59
60
61/*
62 * Actions
63 */
64
65// None
66
67
68/*
69 * View
70 */
71
72$form = new Form($db);
73$formfile = new FormFile($db);
74
75llxHeader("", $langs->trans("KnowledgeManagementArea"), '', '', 0, 0, '', '', '', 'mod-knowledgemanagement page-card_dashboard');
76
77print load_fiche_titre($langs->trans("KnowledgeManagementArea"), '', 'knowledgemanagement.png@knowledgemanagement');
78
79print '<div class="fichecenter"><div class="fichethirdleft">';
80
81
82/* BEGIN MODULEBUILDER DRAFT MYOBJECT
83// Draft MyObject
84if (!empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemanagement->read)
85{
86 $langs->load("orders");
87
88 $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
89 $sql.= ", s.code_client";
90 $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
91 $sql.= ", ".MAIN_DB_PREFIX."societe as s";
92 if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
93 $sql.= " WHERE c.fk_soc = s.rowid";
94 $sql.= " AND c.fk_statut = 0";
95 $sql.= " AND c.entity IN (".getEntity('commande').")";
96 if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
97 if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
98
99 $resql = $db->query($sql);
100 if ($resql)
101 {
102 $total = 0;
103 $num = $db->num_rows($resql);
104
105 print '<table class="noborder centpercent">';
106 print '<tr class="liste_titre">';
107 print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
108
109 $var = true;
110 if ($num > 0)
111 {
112 $i = 0;
113 while ($i < $num)
114 {
115
116 $obj = $db->fetch_object($resql);
117 print '<tr class="oddeven"><td class="nowrap">';
118
119 $myobjectstatic->id=$obj->rowid;
120 $myobjectstatic->ref=$obj->ref;
121 $myobjectstatic->ref_client=$obj->ref_client;
122 $myobjectstatic->total_ht = $obj->total_ht;
123 $myobjectstatic->total_tva = $obj->total_tva;
124 $myobjectstatic->total_ttc = $obj->total_ttc;
125
126 print $myobjectstatic->getNomUrl(1);
127 print '</td>';
128 print '<td class="nowrap">';
129 print '</td>';
130 print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
131 $i++;
132 $total += $obj->total_ttc;
133 }
134 if ($total>0)
135 {
136
137 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
138 }
139 }
140 else
141 {
142
143 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
144 }
145 print "</table><br>";
146
147 $db->free($resql);
148 }
149 else
150 {
151 dol_print_error($db);
152 }
153}
154END MODULEBUILDER DRAFT MYOBJECT */
155
156
157print '</div><div class="fichetwothirdright">';
158
159
160$NBMAX = (!getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT') ? 25 : $conf->global->MAIN_SIZE_SHORTLIST_LIMIT);
161$max = $NBMAX;
162
163/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
164// Last modified myobject
165if (!empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemanagement->read) {
166 $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
167 $sql.= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_myobject as s";
168 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
169 $sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
170 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
171 //if ($socid) $sql.= " AND s.rowid = $socid";
172 $sql .= " ORDER BY s.tms DESC";
173 $sql .= $db->plimit($max, 0);
174
175 $resql = $db->query($sql);
176 if ($resql) {
177 $num = $db->num_rows($resql);
178 $i = 0;
179
180 print '<table class="noborder centpercent">';
181 print '<tr class="liste_titre">';
182 print '<th colspan="2">';
183 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
184 print '</th>';
185 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
186 print '</tr>';
187 if ($num) {
188 while ($i < $num) {
189 $objp = $db->fetch_object($resql);
190
191 $myobjectstatic->id=$objp->rowid;
192 $myobjectstatic->ref=$objp->ref;
193 $myobjectstatic->label=$objp->label;
194 $myobjectstatic->status = $objp->status;
195
196 print '<tr class="oddeven">';
197 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
198 print '<td class="right nowrap">';
199 print "</td>";
200 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
201 print '</tr>';
202 $i++;
203 }
204
205 $db->free($resql);
206 } else {
207 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
208 }
209 print "</table><br>";
210 }
211}
212*/
213
214print '</div></div>';
215
216// End of page
217llxFooter();
218$db->close();
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.
Definition wrapper.php:71
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79