* * $Id$ * $Source$ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ require("./pre.inc.php3"); require("../lib/functions.inc.php3"); require("../societe.class.php3"); require("../contact.class.php3"); require("cactioncomm.class.php3"); require("actioncomm.class.php3"); llxHeader(); $db = new Db(); if ($sortfield == "") { $sortfield="a.datea"; } if ($sortorder == "") { $sortorder="DESC"; } if ($page == -1) { $page = 0 ; } $limit = 26; $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; print "< Prev\n| "; print " Next >\n"; $bc1="bgcolor=\"#90c090\""; $bc2="bgcolor=\"#b0e0b0\""; /* * * * */ if ($action=='add') { $actioncomm = new ActionComm($db); $actioncomm->date = $date; $actioncomm->type = $actionid; $actioncomm->contact = $contactid; $actioncomm->user = $user->id; $actioncomm->societe = $socid; $actioncomm->note = $note; $actioncomm->add(); } /* * * * */ if ($action=='create' && $actionid && $contactid) { $caction = new CActioncomm(); $caction->fetch($db, $actionid); $contact = new Contact($db); $contact->fetch($contactid); $societe = new Societe($db); $societe->get_nom($socid); print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Action'.$caction->libelle.'
Société'.$societe->nom.'Contact'.$contact->fullname.'
Auteur'.$user->fullname.'Date'.strftime('%d %B %Y %H:%M',time()).'
Commentaire'; print '
'; $limit = 10; print '

Vos 10 dernières actions'; } /* * * * */ if ($id) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Action'.$libelle.'
Société'.$nom.'Contact'.$fullname.'
Auteur'.$fullname.'Date'.strftime('%d %B %Y %H:%M',time()).'
Commentaire'; print '
'; $limit = 10; print '

Vos 10 dernières actions'; } /* * * Liste * */ if ($socid) { $sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname "; $sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u"; $sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; if ($type) { $sql .= " AND c.id = $type"; } $sql .= " ORDER BY $sortfield $sortorder "; if ( $db->query($sql) ) { $num = $db->num_rows(); $i = 0; print "

"; print ""; print ''; print ''; print ""; print "\n"; $var=True; while ($i < $num) { $obj = $db->fetch_object( $i); if ($i == 0) { print ""; print ''; print "\n"; print ""; print "\n"; } $var=!$var; if (!$var) { $bc=$bc1; } else { $bc=$bc2; } print ""; print "\n"; print "\n"; print ''; print "\n"; print ""; print "\n"; print ''; print "\n"; $i++; } print "
DateSocieteNote
Auteursocidp\">$obj->societe 
" .strftime("%d %b %Y %H:%M",$obj->da)."socidp\">$obj->societe'.nl2br($obj->note).'
$obj->firstname $obj->name'.$obj->libelle.'
"; $db->free(); } } else { $sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code "; $sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u"; $sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; if ($type) { $sql .= " AND c.id = $type"; } $sql .= " ORDER BY $sortfield $sortorder "; $sql .= $db->plimit( $limit, $offset); if ( $db->query($sql) ) { $num = $db->num_rows(); $i = 0; print "

"; print ""; print ''; print ''; print ''; print ""; print "\n"; $var=True; while ($i < $num) { $obj = $db->fetch_object( $i); $var=!$var; if (!$var) { $bc=$bc1; } else { $bc=$bc2; } print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ''; print "\n"; print "\n"; print "\n"; $i++; } print "
DateSocieteActionAuteur
" .strftime("%d",$obj->da)."" .strftime("%b",$obj->da)."" .strftime("%Y",$obj->da)."" .strftime("%H:%M",$obj->da)."socidp\">$obj->societe'.$obj->libelle.'$obj->code$obj->stcomm
"; $db->free(); } } $db->close(); llxFooter(); ?>