18 |
* |
* |
19 |
* $Id$ |
* $Id$ |
20 |
* $Source$ |
* $Source$ |
|
* |
|
21 |
*/ |
*/ |
22 |
|
|
23 |
/** |
/** |
69 |
*********************************************************************************/ |
*********************************************************************************/ |
70 |
if ($socid > 0) |
if ($socid > 0) |
71 |
{ |
{ |
72 |
$societe = new Societe($db, $socid); |
$societe = new Societe($db, $socid); |
73 |
$result = $societe->fetch($socid); |
$result = $societe->fetch($socid); |
74 |
|
if ($result < 0) |
75 |
|
{ |
76 |
|
dolibarr_print_error($db); |
77 |
|
exit; |
78 |
|
} |
79 |
|
|
|
/* TODO Finir verification PagesJaunes |
|
|
* print '<form action="http://www.pagesjaunes.fr/pj.cgi" method="post" target="_blank">'; |
|
|
* print '<input type="hidden" name="FRM_NOM" value="'.$societe->nom.'">'; |
|
|
* print '<input type="hidden" name="FRM_LOCALITE" value="'.$societe->ville.'">'; |
|
|
* print '<input type="submit">'; |
|
|
* print '</form>'; |
|
|
*/ |
|
|
|
|
|
if ($result) |
|
|
{ |
|
|
$h=0; |
|
|
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; |
|
|
$head[$h][1] = $langs->trans("Company"); |
|
|
$h++; |
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; |
|
|
$head[$h][1] = $langs->trans("Prospect"); |
|
|
$hselected=$h; |
|
|
$h++; |
|
|
|
|
|
if (file_exists(DOL_DOCUMENT_ROOT.'/sl/')) |
|
|
{ |
|
|
$head[$h][0] = DOL_URL_ROOT.'/sl/fiche.php?id='.$societe->id; |
|
|
$head[$h][1] = 'Fiche catalogue'; |
|
|
$h++; |
|
|
} |
|
|
|
|
|
if ($societe->fournisseur) |
|
|
{ |
|
|
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; |
|
|
$head[$h][1] = $langs->trans("Supplier"); |
|
|
$h++; |
|
|
} |
|
|
|
|
|
if ($conf->compta->enabled) { |
|
|
$langs->load("compta"); |
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; |
|
|
$head[$h][1] = $langs->trans("Accountancy"); |
|
|
$h++; |
|
|
} |
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; |
|
|
$head[$h][1] = $langs->trans("Note"); |
|
|
$h++; |
|
|
if ($user->societe_id == 0) |
|
|
{ |
|
|
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; |
|
|
$head[$h][1] = $langs->trans("Documents"); |
|
|
$h++; |
|
|
} |
|
80 |
|
|
81 |
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; |
/* TODO Finir verification PagesJaunes |
82 |
$head[$h][1] = $langs->trans("Notifications"); |
* print '<form action="http://www.pagesjaunes.fr/pj.cgi" method="post" target="_blank">'; |
83 |
|
* print '<input type="hidden" name="FRM_NOM" value="'.$societe->nom.'">'; |
84 |
|
* print '<input type="hidden" name="FRM_LOCALITE" value="'.$societe->ville.'">'; |
85 |
|
* print '<input type="submit">'; |
86 |
|
* print '</form>'; |
87 |
|
*/ |
88 |
|
|
89 |
|
$h=0; |
90 |
|
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; |
91 |
|
$head[$h][1] = $langs->trans("Company"); |
92 |
|
$h++; |
93 |
|
|
94 |
|
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; |
95 |
|
$head[$h][1] = $langs->trans("Prospect"); |
96 |
|
$hselected=$h; |
97 |
|
$h++; |
98 |
|
|
99 |
|
if (file_exists(DOL_DOCUMENT_ROOT.'/sl/')) |
100 |
|
{ |
101 |
|
$head[$h][0] = DOL_URL_ROOT.'/sl/fiche.php?id='.$societe->id; |
102 |
|
$head[$h][1] = 'Fiche catalogue'; |
103 |
|
$h++; |
104 |
|
} |
105 |
|
|
106 |
dolibarr_fiche_head($head, $hselected, $societe->nom); |
if ($societe->fournisseur) |
107 |
|
{ |
108 |
|
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; |
109 |
|
$head[$h][1] = $langs->trans("Supplier"); |
110 |
|
$h++; |
111 |
|
} |
112 |
|
|
113 |
/* |
if ($conf->compta->enabled) |
114 |
* |
{ |
115 |
*/ |
$langs->load("compta"); |
116 |
|
$head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; |
117 |
|
$head[$h][1] = $langs->trans("Accountancy"); |
118 |
|
$h++; |
119 |
|
} |
120 |
|
|
121 |
|
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; |
122 |
|
$head[$h][1] = $langs->trans("Note"); |
123 |
|
$h++; |
124 |
|
if ($user->societe_id == 0) |
125 |
|
{ |
126 |
|
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; |
127 |
|
$head[$h][1] = $langs->trans("Documents"); |
128 |
|
$h++; |
129 |
|
} |
130 |
|
|
131 |
|
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; |
132 |
|
$head[$h][1] = $langs->trans("Notifications"); |
133 |
|
|
134 |
|
|
135 |
|
dolibarr_fiche_head($head, $hselected, $societe->nom); |
136 |
|
|
137 |
|
/* |
138 |
|
* |
139 |
|
*/ |
140 |
print "<table width=\"100%\">\n"; |
print "<table width=\"100%\">\n"; |
141 |
print '<tr><td valign="top" width="50%">'; |
print '<tr><td valign="top" width="50%">'; |
142 |
|
|
143 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
144 |
print '<tr><td width="25%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; |
print '<tr><td width="25%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; |
145 |
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse)."</td></tr>"; |
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse)."</td></tr>"; |
146 |
|
|
147 |
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td colspan="3">'.$societe->cp." ".$societe->ville.'</td></tr>'; |
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td colspan="3">'.$societe->cp." ".$societe->ville.'</td></tr>'; |
148 |
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$societe->pays.'</td></tr>'; |
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$societe->pays.'</td></tr>'; |
149 |
|
|
150 |
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.$societe->tel.' </td><td>Fax</td><td>'.$societe->fax.' </td></tr>'; |
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.$societe->tel.' </td><td>Fax</td><td>'.$societe->fax.' </td></tr>'; |
151 |
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>"; |
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>"; |
152 |
|
|
153 |
if ($societe->rubrique) |
if ($societe->rubrique) |
154 |
{ |
{ |
155 |
print "<tr><td>Rubrique</td><td colspan=\"3\">$societe->rubrique</td></tr>"; |
print "<tr><td>Rubrique</td><td colspan=\"3\">$societe->rubrique</td></tr>"; |
156 |
} |
} |
157 |
|
|
158 |
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; |
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; |
159 |
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$societe->statut_commercial.'</td>'; |
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$societe->statut_commercial.'</td>'; |
171 |
print '</a>'; |
print '</a>'; |
172 |
print '</td></tr>'; |
print '</td></tr>'; |
173 |
print '</table>'; |
print '</table>'; |
174 |
|
|
175 |
print '</div>'; |
print '</div>'; |
176 |
|
|
177 |
/* |
/* |
178 |
* |
* |
179 |
*/ |
*/ |
180 |
print "</td>\n"; |
print "</td>\n"; |
181 |
print '<td valign="top" width="50%">'; |
print '<td valign="top" width="50%">'; |
182 |
|
|
183 |
/* |
/* |
184 |
* |
* |
185 |
* Propales |
* Propales |
186 |
* |
* |
187 |
*/ |
*/ |
188 |
$var = true; |
$var = true; |
189 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
190 |
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; |
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; |
192 |
$sql .= " AND s.idp = $societe->id ORDER BY p.datep DESC"; |
$sql .= " AND s.idp = $societe->id ORDER BY p.datep DESC"; |
193 |
|
|
194 |
if ( $db->query($sql) ) |
if ( $db->query($sql) ) |
195 |
{ |
{ |
196 |
$num = $db->num_rows(); |
$num = $db->num_rows(); |
197 |
if ($num >0 ) |
if ($num >0 ) |
198 |
{ |
{ |
199 |
print "<tr $bc[$var]><td colspan=\"4\">"; |
print "<tr $bc[$var]><td colspan=\"4\">"; |
200 |
print '<table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProposals").'</td>'; |
print '<table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProposals").'</td>'; |
201 |
print '<td align="right"><a href="../propal.php?socidp='.$societe->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>'; |
print '<td align="right"><a href="../propal.php?socidp='.$societe->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>'; |
202 |
print '</tr></table>'; |
print '</tr></table>'; |
203 |
print '</td></tr>'; |
print '</td></tr>'; |
204 |
$var=!$var; |
$var=!$var; |
205 |
} |
} |
206 |
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ; |
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ; |
207 |
while ($i < $num && $i < 2) |
while ($i < $num && $i < 2) |
208 |
{ |
{ |
209 |
$objp = $db->fetch_object(); |
$objp = $db->fetch_object(); |
210 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
211 |
print "<td><a href=\"../propal.php?propalid=$objp->propalid\">"; |
print "<td><a href=\"../propal.php?propalid=$objp->propalid\">"; |
212 |
print img_object($langs->trans("ShowPropal"),"propal"); |
print img_object($langs->trans("ShowPropal"),"propal"); |
213 |
print " $objp->ref</a>\n"; |
print " $objp->ref</a>\n"; |
214 |
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) |
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) |
215 |
{ |
{ |
216 |
print " <b>> 15 jours</b>"; |
print " <b>> 15 jours</b>"; |
217 |
} |
} |
218 |
print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</td>\n"; |
print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</td>\n"; |
219 |
print "<td align=\"right\">".price($objp->price)."</td>\n"; |
print "<td align=\"right\">".price($objp->price)."</td>\n"; |
220 |
print "<td align=\"center\">$objp->statut</td></tr>\n"; |
print "<td align=\"center\">$objp->statut</td></tr>\n"; |
221 |
$var=!$var; |
$var=!$var; |
222 |
$i++; |
$i++; |
223 |
} |
} |
224 |
$db->free(); |
$db->free(); |
225 |
} |
} |
226 |
|
|
227 |
print "</table>"; |
print "</table>"; |
228 |
|
|
229 |
print "</td></tr>"; |
print "</td></tr>"; |
231 |
|
|
232 |
|
|
233 |
/* |
/* |
234 |
* Barre d'action |
* Barre d'action |
235 |
* |
* |
236 |
*/ |
*/ |
237 |
|
|
238 |
print '<div class="tabsAction">'; |
print '<div class="tabsAction">'; |
239 |
|
|
243 |
|
|
244 |
|
|
245 |
if ($conf->propal->enabled && defined("MAIN_MODULE_PROPALE") && MAIN_MODULE_PROPALE && $user->rights->propale->creer) |
if ($conf->propal->enabled && defined("MAIN_MODULE_PROPALE") && MAIN_MODULE_PROPALE && $user->rights->propale->creer) |
246 |
{ |
{ |
247 |
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socidp='.$societe->id.'&action=create">'.$langs->trans("AddProp").'</a>'; |
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socidp='.$societe->id.'&action=create">'.$langs->trans("AddProp").'</a>'; |
248 |
} |
} |
249 |
|
|
250 |
if ($conf->projet->enabled && $user->rights->projet->creer) |
if ($conf->projet->enabled && $user->rights->projet->creer) |
251 |
{ |
{ |
252 |
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socidp='.$socid.'&action=create">'.$langs->trans("AddProject").'</a>'; |
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socidp='.$socid.'&action=create">'.$langs->trans("AddProject").'</a>'; |
253 |
} |
} |
254 |
print '</div>'; |
print '</div>'; |
255 |
|
|
256 |
print '<br>'; |
print '<br>'; |
257 |
|
|
258 |
/* |
/* |
259 |
* |
* |
260 |
* Liste des contacts |
* Liste des contacts |
261 |
* |
* |
262 |
*/ |
*/ |
263 |
if (defined("MAIN_MODULE_CLICKTODIAL") && MAIN_MODULE_CLICKTODIAL==1) |
if (defined("MAIN_MODULE_CLICKTODIAL") && MAIN_MODULE_CLICKTODIAL==1) |
264 |
{ |
{ |
265 |
$user->fetch_clicktodial(); // lecture des infos de clicktodial |
$user->fetch_clicktodial(); // lecture des infos de clicktodial |
266 |
} |
} |
267 |
|
|
268 |
print '<table width="100%" class="noborder">'; |
print '<table width="100%" class="noborder">'; |
269 |
|
|
271 |
print '<td>Poste</td><td colspan="2">'.$langs->trans("Tel").'</td>'; |
print '<td>Poste</td><td colspan="2">'.$langs->trans("Tel").'</td>'; |
272 |
print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>'; |
print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>'; |
273 |
print '<td> </td>'; |
print '<td> </td>'; |
274 |
|
|
275 |
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $societe->id ORDER by p.datec"; |
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; |
276 |
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; |
277 |
|
$sql.= " WHERE p.fk_soc = $societe->id ORDER by p.datec"; |
278 |
$result = $db->query($sql); |
$result = $db->query($sql); |
279 |
$i = 0 ; $num = $db->num_rows(); $tag = True; |
$i = 0 ; $num = $db->num_rows(); $tag = True; |
280 |
while ($i < $num) |
while ($i < $num) |
281 |
{ |
{ |
282 |
$obj = $db->fetch_object($result); |
$obj = $db->fetch_object($result); |
283 |
$var = !$var; |
$var = !$var; |
284 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
285 |
|
|
286 |
print '<td>'; |
print '<td>'; |
287 |
|
|
288 |
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->firstname.' '. $obj->name.'</a> '; |
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">'; |
289 |
|
print img_object($langs->trans("ShowContact"),"contact").' '.$obj->firstname.' '. $obj->name.'</a> '; |
290 |
if ($obj->note) |
|
291 |
{ |
if ($obj->note) |
292 |
print "<br>".nl2br($obj->note); |
{ |
293 |
} |
print "<br>".nl2br($obj->note); |
294 |
print "</td>"; |
} |
295 |
print "<td>$obj->poste </td>"; |
print "</td>"; |
296 |
|
print "<td>$obj->poste </td>"; |
297 |
print '<td>'; |
|
298 |
|
print '<td>'; |
299 |
/* |
|
300 |
* Lien click to dial |
/* |
301 |
*/ |
* Lien click to dial |
302 |
|
*/ |
303 |
if (strlen($obj->phone) && $user->clicktodial_enabled == 1) |
|
304 |
{ |
if (strlen($obj->phone) && $user->clicktodial_enabled == 1) |
305 |
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'&call='.$obj->phone.'">'; |
{ |
306 |
print img_phone_out("Appel émis") ; |
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'&call='.$obj->phone.'">'; |
307 |
} |
print img_phone_out("Appel émis") ; |
308 |
print '</td>'; |
} |
309 |
|
print '</td>'; |
310 |
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'; |
|
311 |
|
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'; |
312 |
print ' '.dolibarr_print_phone($obj->phone).'</a> </td>'; |
|
313 |
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>'; |
print ' '.dolibarr_print_phone($obj->phone).'</a> </td>'; |
314 |
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>'; |
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>'; |
315 |
print "<td align=\"center\">"; |
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>'; |
316 |
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&id='.$obj->idp.'">'; |
print "<td align=\"center\">"; |
317 |
print img_edit(); |
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&id='.$obj->idp.'">'; |
318 |
print '</a></td>'; |
print img_edit(); |
319 |
print "</tr>\n"; |
print '</a></td>'; |
320 |
$i++; |
print "</tr>\n"; |
321 |
$tag = !$tag; |
$i++; |
322 |
} |
$tag = !$tag; |
323 |
print "</table>"; |
} |
324 |
|
print "</table>"; |
|
print "<p />"; |
|
|
|
|
|
/* |
|
|
* Listes des actions a faire |
|
|
*/ |
|
|
print '<table width="100%" class="noborder">'; |
|
|
print '<tr class="liste_titre"><td colspan="8">'.$langs->trans("ActionsToDo").'</td></tr>'; |
|
|
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; |
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; |
|
|
$sql .= " WHERE a.fk_soc = $societe->id "; |
|
|
$sql .= " AND u.rowid = a.fk_user_author"; |
|
|
$sql .= " AND c.id=a.fk_action AND a.percent < 100"; |
|
|
$sql .= " ORDER BY a.datea DESC, a.id DESC"; |
|
|
|
|
|
if ( $db->query($sql) ) |
|
|
{ |
|
|
|
|
|
$i = 0 ; $num = $db->num_rows(); |
|
|
while ($i < $num) |
|
|
{ |
|
|
$var = !$var; |
|
|
|
|
|
$obj = $db->fetch_object(); |
|
|
|
|
|
print "<tr $bc[$var]>"; |
|
|
|
|
|
if ($oldyear == strftime("%Y",$obj->da) ) |
|
|
{ |
|
|
//print '<td align="center">|</td>'; |
|
|
print '<td align="center">' .strftime("%Y",$obj->da)."</td>\n"; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print '<td align="center">' .strftime("%Y",$obj->da)."</td>\n"; |
|
|
$oldyear = strftime("%Y",$obj->da); |
|
|
} |
|
|
|
|
|
if ($oldmonth == strftime("%Y%b",$obj->da) ) |
|
|
{ |
|
|
print '<td align="center">' .strftime("%b",$obj->da)."</td>\n"; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print "<td align=\"center\">" .strftime("%b",$obj->da)."</td>\n"; |
|
|
$oldmonth = strftime("%Y%b",$obj->da); |
|
|
} |
|
|
|
|
|
print "<td>" .strftime("%d",$obj->da)."</td>\n"; |
|
|
print "<td>" .strftime("%H:%M",$obj->da)."</td>\n"; |
|
|
|
|
|
print '<td width="10%"> </td>'; |
|
|
|
|
|
|
|
|
print '<td width="40%">'; |
|
|
if ($obj->propalrowid) |
|
|
{ |
|
|
print '<a href="../propal.php?propalid='.$obj->propalrowid.'">'; |
|
|
$transcode=$langs->trans("Action".$obj->acode); |
|
|
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); |
|
|
print $libelle; |
|
|
print '</a>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task").' '; |
|
|
$transcode=$langs->trans("Action".$obj->acode); |
|
|
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); |
|
|
print $libelle; |
|
|
print '</a>'; |
|
|
} |
|
|
print '</td>'; |
|
|
|
|
|
/* |
|
|
* Contact pour cette action |
|
|
* |
|
|
*/ |
|
|
print '<td width="40%">'; |
|
|
if ($obj->fk_contact) |
|
|
{ |
|
|
$contact = new Contact($db); |
|
|
$contact->fetch($obj->fk_contact); |
|
|
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.$contact->fullname.'</a></td>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print ' </td>'; |
|
|
} |
|
|
/* |
|
|
* |
|
|
*/ |
|
|
print '<td>'; |
|
|
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user_author.'">'; |
|
|
print $obj->code.'</a></td>'; |
|
|
print "</tr>\n"; |
|
|
|
|
|
if ($obj->note) |
|
|
{ |
|
|
print "<tr $bc[$var]>"; |
|
|
print '<td colspan="5"> </td><td colspan="3">'.stripslashes($obj->note).'</td></tr>'; |
|
|
} |
|
|
|
|
|
$i++; |
|
|
} |
|
|
print "</table>"; |
|
|
|
|
|
$db->free(); |
|
|
} |
|
|
else |
|
|
{ |
|
|
dolibarr_print_error($db); |
|
|
} |
|
|
|
|
|
/* |
|
|
* Listes des actions effectuees |
|
|
*/ |
|
|
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; |
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; |
|
|
$sql .= " WHERE a.fk_soc = $societe->id "; |
|
|
$sql .= " AND u.rowid = a.fk_user_author"; |
|
|
$sql .= " AND c.id=a.fk_action AND a.percent = 100"; |
|
|
$sql .= " ORDER BY a.datea DESC, a.id DESC"; |
|
|
if ( $db->query($sql) ) |
|
|
{ |
|
|
|
|
|
$i = 0 ; |
|
|
$num = $db->num_rows(); |
|
|
|
|
|
if ($num) |
|
|
{ |
|
|
print '<table width="100%" class="noborder">'; |
|
|
print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">'.$langs->trans("ActionsDone").'</a></td></tr>'; |
|
|
print '<tr>'; |
|
|
print '<td valign="top">'; |
|
|
|
|
|
print '<table width="100%" class="noborder">'; |
|
|
|
|
|
$oldyear=''; |
|
|
$oldmonth=''; |
|
|
while ($i < $num) |
|
|
{ |
|
|
$var = !$var; |
|
|
|
|
|
$obj = $db->fetch_object(); |
|
|
print "<tr $bc[$var]>"; |
|
|
|
|
|
if ($oldyear == strftime("%Y",$obj->da) ) |
|
|
{ |
|
|
print '<td align="center">|</td>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print "<td align=\"center\">" .strftime("%Y",$obj->da)."</td>\n"; |
|
|
$oldyear = strftime("%Y",$obj->da); |
|
|
} |
|
|
|
|
|
if ($oldmonth == strftime("%Y%b",$obj->da) ) |
|
|
{ |
|
|
print '<td align="center">|</td>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print "<td align=\"center\">" .strftime("%b",$obj->da)."</td>\n"; |
|
|
$oldmonth = strftime("%Y%b",$obj->da); |
|
|
} |
|
|
|
|
|
print "<td>" .strftime("%d",$obj->da)."</td>\n"; |
|
|
print "<td>" .strftime("%H:%M",$obj->da)."</td>\n"; |
|
|
|
|
|
print '<td width="10%"> </td>'; |
|
|
|
|
|
print '<td width="40%">'; |
|
|
if ($obj->propalrowid) |
|
|
{ |
|
|
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_file().' '.$obj->libelle.'</a>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.'</a>'; |
|
|
} |
|
|
print '</td>'; |
|
|
/* |
|
|
* Contact pour cette action |
|
|
* |
|
|
*/ |
|
|
if ($obj->fk_contact) |
|
|
{ |
|
|
$contact = new Contact($db); |
|
|
$contact->fetch($obj->fk_contact); |
|
|
print '<td width="40%">'.$contact->fullname.'</td>'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
print '<td width="40%"> </td>'; |
|
|
} |
|
|
/* |
|
|
*/ |
|
|
print '<td width="20%"><a href="../user/fiche.php?id='.$obj->fk_user_author.'">'.$obj->code.'</a></td>'; |
|
|
print "</tr>\n"; |
|
|
|
|
|
if ($i < 2 && strlen($obj->note)) |
|
|
{ |
|
|
print "<tr $bc[$var]>"; |
|
|
print '<td colspan="5"> </td><td colspan="3">'; |
|
|
print stripslashes(nl2br($obj->note)); |
|
|
print '</td></tr>'; |
|
|
} |
|
|
|
|
|
$i++; |
|
|
} |
|
|
print "</table>"; |
|
|
print "</td></tr></table>"; |
|
|
} |
|
|
$db->free(); |
|
|
} |
|
|
else |
|
|
{ |
|
|
dolibarr_print_error($db); |
|
|
} |
|
|
|
|
|
/* |
|
|
* |
|
|
* Notes sur la societe |
|
|
* |
|
|
*/ |
|
|
if (strlen(trim($societe->note))) |
|
|
{ |
|
|
print '<table class="border" width="100%" bgcolor="#e0e0e0">'; |
|
|
print "<tr><td>".nl2br($societe->note)."</td></tr>"; |
|
|
print "</table>"; |
|
|
} |
|
325 |
|
|
326 |
} |
/* |
327 |
else |
* Listes des actions a faire |
328 |
|
*/ |
329 |
|
$var=true; |
330 |
|
print '<br>'; |
331 |
|
print '<table width="100%" class="noborder">'; |
332 |
|
print '<tr class="liste_titre"><td colspan="8">'.$langs->trans("ActionsToDo").'</td></tr>'; |
333 |
|
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; |
334 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; |
335 |
|
$sql .= " WHERE a.fk_soc = $societe->id "; |
336 |
|
$sql .= " AND u.rowid = a.fk_user_author"; |
337 |
|
$sql .= " AND c.id=a.fk_action AND a.percent < 100"; |
338 |
|
$sql .= " ORDER BY a.datea DESC, a.id DESC"; |
339 |
|
|
340 |
|
$resql=$db->query($sql); |
341 |
|
if ($resql) |
342 |
|
{ |
343 |
|
$i = 0 ; $num = $db->num_rows($resql); |
344 |
|
while ($i < $num) |
345 |
|
{ |
346 |
|
$var = !$var; |
347 |
|
|
348 |
|
$obj = $db->fetch_object($resql); |
349 |
|
|
350 |
|
print "<tr $bc[$var]>"; |
351 |
|
|
352 |
|
if ($oldyear == strftime("%Y",$obj->da) ) |
353 |
|
{ |
354 |
|
//print '<td align="center">|</td>'; |
355 |
|
print '<td align="center">' .strftime("%Y",$obj->da)."</td>\n"; |
356 |
|
} |
357 |
|
else |
358 |
|
{ |
359 |
|
print '<td align="center">' .strftime("%Y",$obj->da)."</td>\n"; |
360 |
|
$oldyear = strftime("%Y",$obj->da); |
361 |
|
} |
362 |
|
|
363 |
|
if ($oldmonth == strftime("%Y%b",$obj->da) ) |
364 |
|
{ |
365 |
|
print '<td align="center">' .strftime("%b",$obj->da)."</td>\n"; |
366 |
|
} |
367 |
|
else |
368 |
|
{ |
369 |
|
print "<td align=\"center\">" .strftime("%b",$obj->da)."</td>\n"; |
370 |
|
$oldmonth = strftime("%Y%b",$obj->da); |
371 |
|
} |
372 |
|
|
373 |
|
print "<td>" .strftime("%d",$obj->da)."</td>\n"; |
374 |
|
print "<td>" .strftime("%H:%M",$obj->da)."</td>\n"; |
375 |
|
|
376 |
|
print '<td width="10%"> </td>'; |
377 |
|
|
378 |
|
|
379 |
|
print '<td width="40%">'; |
380 |
|
if ($obj->propalrowid) |
381 |
|
{ |
382 |
|
print '<a href="../propal.php?propalid='.$obj->propalrowid.'">'; |
383 |
|
$transcode=$langs->trans("Action".$obj->acode); |
384 |
|
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); |
385 |
|
print $libelle; |
386 |
|
print '</a>'; |
387 |
|
} |
388 |
|
else |
389 |
|
{ |
390 |
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task").' '; |
391 |
|
$transcode=$langs->trans("Action".$obj->acode); |
392 |
|
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); |
393 |
|
print $libelle; |
394 |
|
print '</a>'; |
395 |
|
} |
396 |
|
print '</td>'; |
397 |
|
|
398 |
|
/* |
399 |
|
* Contact pour cette action |
400 |
|
* |
401 |
|
*/ |
402 |
|
print '<td width="40%">'; |
403 |
|
if ($obj->fk_contact) |
404 |
|
{ |
405 |
|
$contact = new Contact($db); |
406 |
|
$contact->fetch($obj->fk_contact); |
407 |
|
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.$contact->fullname.'</a></td>'; |
408 |
|
} |
409 |
|
else |
410 |
|
{ |
411 |
|
print ' </td>'; |
412 |
|
} |
413 |
|
/* |
414 |
|
* |
415 |
|
*/ |
416 |
|
print '<td>'; |
417 |
|
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user_author.'">'; |
418 |
|
print $obj->code.'</a></td>'; |
419 |
|
print "</tr>\n"; |
420 |
|
|
421 |
|
if ($obj->note) |
422 |
|
{ |
423 |
|
print "<tr $bc[$var]>"; |
424 |
|
print '<td colspan="5"> </td><td colspan="3">'.stripslashes($obj->note).'</td></tr>'; |
425 |
|
} |
426 |
|
|
427 |
|
$i++; |
428 |
|
} |
429 |
|
print "</table>"; |
430 |
|
|
431 |
|
$db->free($resql); |
432 |
|
} |
433 |
|
else |
434 |
|
{ |
435 |
|
dolibarr_print_error($db); |
436 |
|
} |
437 |
|
|
438 |
|
/* |
439 |
|
* Listes des actions effectuees |
440 |
|
*/ |
441 |
|
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; |
442 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; |
443 |
|
$sql .= " WHERE a.fk_soc = $societe->id "; |
444 |
|
$sql .= " AND u.rowid = a.fk_user_author"; |
445 |
|
$sql .= " AND c.id=a.fk_action AND a.percent = 100"; |
446 |
|
$sql .= " ORDER BY a.datea DESC, a.id DESC"; |
447 |
|
$resql=$db->query($sql); |
448 |
|
if ($resql) |
449 |
{ |
{ |
450 |
dolibarr_print_error($db); |
$i = 0 ; |
451 |
|
$num = $db->num_rows($resql); |
452 |
|
|
453 |
|
if ($num) |
454 |
|
{ |
455 |
|
print '<br>'; |
456 |
|
|
457 |
|
print '<table width="100%" class="noborder">'; |
458 |
|
print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">'.$langs->trans("ActionsDone").'</a></td></tr>'; |
459 |
|
print '<tr>'; |
460 |
|
print '<td valign="top">'; |
461 |
|
|
462 |
|
print '<table width="100%" class="noborder">'; |
463 |
|
|
464 |
|
$oldyear=''; |
465 |
|
$oldmonth=''; |
466 |
|
while ($i < $num) |
467 |
|
{ |
468 |
|
$var = !$var; |
469 |
|
|
470 |
|
$obj = $db->fetch_object($resql); |
471 |
|
print "<tr $bc[$var]>"; |
472 |
|
|
473 |
|
if ($oldyear == strftime("%Y",$obj->da) ) |
474 |
|
{ |
475 |
|
print '<td align="center">|</td>'; |
476 |
|
} |
477 |
|
else |
478 |
|
{ |
479 |
|
print "<td align=\"center\">" .strftime("%Y",$obj->da)."</td>\n"; |
480 |
|
$oldyear = strftime("%Y",$obj->da); |
481 |
|
} |
482 |
|
|
483 |
|
if ($oldmonth == strftime("%Y%b",$obj->da) ) |
484 |
|
{ |
485 |
|
print '<td align="center">|</td>'; |
486 |
|
} |
487 |
|
else |
488 |
|
{ |
489 |
|
print "<td align=\"center\">" .strftime("%b",$obj->da)."</td>\n"; |
490 |
|
$oldmonth = strftime("%Y%b",$obj->da); |
491 |
|
} |
492 |
|
|
493 |
|
print "<td>" .strftime("%d",$obj->da)."</td>\n"; |
494 |
|
print "<td>" .strftime("%H:%M",$obj->da)."</td>\n"; |
495 |
|
|
496 |
|
print '<td width="10%"> </td>'; |
497 |
|
|
498 |
|
print '<td width="40%">'; |
499 |
|
if ($obj->propalrowid) |
500 |
|
{ |
501 |
|
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_file().' '.$obj->libelle.'</a>'; |
502 |
|
} |
503 |
|
else |
504 |
|
{ |
505 |
|
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.'</a>'; |
506 |
|
} |
507 |
|
print '</td>'; |
508 |
|
/* |
509 |
|
* Contact pour cette action |
510 |
|
* |
511 |
|
*/ |
512 |
|
if ($obj->fk_contact) |
513 |
|
{ |
514 |
|
$contact = new Contact($db); |
515 |
|
$contact->fetch($obj->fk_contact); |
516 |
|
print '<td width="40%">'.$contact->fullname.'</td>'; |
517 |
|
} |
518 |
|
else |
519 |
|
{ |
520 |
|
print '<td width="40%"> </td>'; |
521 |
|
} |
522 |
|
/* |
523 |
|
*/ |
524 |
|
print '<td width="20%"><a href="../user/fiche.php?id='.$obj->fk_user_author.'">'.$obj->code.'</a></td>'; |
525 |
|
print "</tr>\n"; |
526 |
|
|
527 |
|
if ($i < 2 && strlen($obj->note)) |
528 |
|
{ |
529 |
|
print "<tr $bc[$var]>"; |
530 |
|
print '<td colspan="5"> </td><td colspan="3">'; |
531 |
|
print stripslashes(nl2br($obj->note)); |
532 |
|
print '</td></tr>'; |
533 |
|
} |
534 |
|
|
535 |
|
$i++; |
536 |
|
} |
537 |
|
print "</table>"; |
538 |
|
print "</td></tr></table>"; |
539 |
|
} |
540 |
|
$db->free(); |
541 |
} |
} |
542 |
|
else |
543 |
|
{ |
544 |
|
dolibarr_print_error($db); |
545 |
|
} |
546 |
|
|
547 |
} |
} |
548 |
|
|
549 |
$db->close(); |
$db->close(); |