Fix: Corrige nombreux problèmes sur enregistrements incomplets des actions.

This commit is contained in:
Laurent Destailleur 2005-07-10 02:05:09 +00:00
parent 0e2dd91381
commit 2333344f2a
19 changed files with 196 additions and 297 deletions

View File

@ -38,10 +38,11 @@ class ActionComm
var $id; var $id;
var $db; var $db;
var $label; var $type_id;
var $date;
var $type_code; var $type_code;
var $type; var $type;
var $label;
var $date;
var $priority; var $priority;
var $user; var $user;
var $author; var $author;
@ -84,7 +85,9 @@ class ActionComm
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm";
$sql.= "(datea,fk_action,fk_soc,note,fk_contact,fk_user_author,fk_user_action,label,percent,priority,"; $sql.= "(datea,fk_action,fk_soc,note,fk_contact,fk_user_author,fk_user_action,label,percent,priority,";
$sql.= "fk_facture,propalrowid)"; $sql.= "fk_facture,propalrowid)";
$sql.= " VALUES (now(), '".$this->type_code."', '".$this->societe->id."' ,'".addslashes($this->note)."',"; $sql.= " VALUES (";
$sql.= "'".$this->db->idate($this->date)."',";
$sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',";
$sql.= ($this->contact->id?$this->contact->id:"null").","; $sql.= ($this->contact->id?$this->contact->id:"null").",";
$sql.= "'$author->id', '".$this->user->id ."', '".addslashes($this->label)."','".$this->percent."','".$this->priority."',"; $sql.= "'$author->id', '".$this->user->id ."', '".addslashes($this->label)."','".$this->percent."','".$this->priority."',";
$sql.= ($this->facid?$this->facid:"null").","; $sql.= ($this->facid?$this->facid:"null").",";
@ -93,27 +96,32 @@ class ActionComm
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
$idaction = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm");
if ($conf->webcal->enabled) { if ($conf->webcal->enabled) {
if (is_object($webcal))
{ // Appel a webcal
dolibarr_syslog("ActionComm::ajout entree dans webcal"); dolibarr_syslog("ActionComm::ajout entree dans webcal");
// Si webcal demandé et non défini en tant qu'objet, on le construit
if (! is_object($webcal) && $webcal == 1)
{
$webcal=new ActionComm($this->db);
$webcal->date=$this->date;
$webcal->duree=0;
$webcal->texte=$this->societe;
$webcal->desc="Action ".$this->type_code."\n".$this->note;
}
// Ajoute entrée dans webcal // Ajoute entrée dans webcal
$result=$webcal->add($author,$webcal->date,$webcal->texte,$webcal->desc); $result=$webcal->add($author,$webcal->date,$webcal->texte,$webcal->desc);
if ($result < 0) { if ($result < 0) {
$this->error="Echec insertion dans webcal: ".$webcal->error; $this->error="Echec insertion dans webcal: ".$webcal->error;
} }
}
else if ($webcal == 1)
{
// \todo On ajoute une entrée générique, pour l'instant pas utilisé
} }
}
return $idaction; return $this->id;
} }
else else
{ {
@ -131,7 +139,7 @@ class ActionComm
{ {
global $langs; global $langs;
$sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note, a.label, c.code, c.libelle, fk_soc, fk_user_author, fk_contact, fk_facture, a.percent"; $sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note, a.label, a.fk_action as type_id, c.code, c.libelle, fk_soc, fk_user_author, fk_contact, fk_facture, a.percent";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c";
$sql.= " WHERE a.id=$id AND a.fk_action=c.id;"; $sql.= " WHERE a.id=$id AND a.fk_action=c.id;";
@ -143,11 +151,12 @@ class ActionComm
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $id; $this->id = $id;
$this->type_id = $type_id;
$this->type_code = $obj->code; $this->type_code = $obj->code;
$transcode=$langs->trans("Action".$obj->code); $transcode=$langs->trans("Action".$obj->code);
$type_libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); $type_libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle);
$this->type = $type_libelle; $this->type = $type_libelle;
$this->libelle = $obj->label; $this->label = $obj->label;
$this->date = $obj->da; $this->date = $obj->da;
$this->note =$obj->note; $this->note =$obj->note;
$this->percent =$obj->percent; $this->percent =$obj->percent;
@ -186,26 +195,18 @@ class ActionComm
/** /**
* \brief Met a jour l'action en base * \brief Met a jour l'action en base
* \return int 1 en cas de succès * \return int <0 si ko, >0 si ok
*/ */
function update() function update()
{ {
if ($this->percent > 100) if ($this->percent > 100) $this->percent = 100;
{
$this->percent = 100;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql .= " SET percent=$this->percent"; $sql.= " SET percent='".$this->percent."'";
if ($this->percent == 100) $sql .= ", datea = now()";
if ($this->percent == 100) if ($this->note) $sql .= ", note = '".addslashes($this->note)."'";
{ $sql.= ", fk_contact =". $this->contact->id;
$sql .= ", datea = now()"; $sql.= " WHERE id=$this->id;";
}
$sql .= ", fk_contact =". $this->contact->id;
$sql .= " WHERE id=$this->id;";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {

View File

@ -37,7 +37,12 @@ class CActioncomm {
var $db; var $db;
var $id; var $id;
var $code;
var $type;
var $libelle; var $libelle;
var $active;
var $error; var $error;
var $type_actions=array(); var $type_actions=array();
@ -60,7 +65,9 @@ class CActioncomm {
function fetch($id) function fetch($id)
{ {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_actioncomm WHERE id=$id;"; $sql = "SELECT code, type, libelle, active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
$sql.= " WHERE id=$id";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -70,7 +77,10 @@ class CActioncomm {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $id; $this->id = $id;
$this->code = $obj->code;
$this->type = $obj->type;
$this->libelle = $obj->libelle; $this->libelle = $obj->libelle;
$this->active = $obj->active;
return 1; return 1;
} }

View File

@ -27,13 +27,12 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require_once("../../contact.class.php");
require("../../contact.class.php"); require_once("../../cactioncomm.class.php");
require("../../cactioncomm.class.php"); require_once("../../actioncomm.class.php");
require("../../actioncomm.class.php");
if ($conf->webcal->enabled) { if ($conf->webcal->enabled) {
require("../../lib/webcal.class.php"); require_once("../../lib/webcal.class.php");
} }
$langs->load("companies"); $langs->load("companies");
@ -71,29 +70,24 @@ if ($_POST["action"] == 'add_action')
{ {
$db->begin(); $db->begin();
$cactioncomm = new CActionComm($db);
$cactioncomm->fetch($_POST["actionid"]);
// Initialisation objet actioncomm
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->type_code = $_POST["actionid"]; $actioncomm->type_id = $_POST["actionid"];
$actioncomm->type_code = $cactioncomm->code;
$actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0; $actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0;
if ($_POST["actionid"] == 5)
{
if ($contact->fullname) { $actioncomm->label = $langs->trans("TaskRDVWith",$contact->fullname); }
else { $actioncomm->label = $langs->trans("TaskRDV"); }
} else {
$actioncomm->label = $_POST["label"]; $actioncomm->label = $_POST["label"];
} $actioncomm->date = mktime($_POST["heurehour"],
$actioncomm->date = $db->idate(mktime($_POST["heurehour"],
$_POST["heuremin"], $_POST["heuremin"],
0, 0,
$_POST["acmonth"], $_POST["acmonth"],
$_POST["acday"], $_POST["acday"],
$_POST["acyear"]) $_POST["acyear"]);
);
$actioncomm->percent = isset($_POST["percentage"])?$_POST["percentage"]:0; $actioncomm->percent = isset($_POST["percentage"])?$_POST["percentage"]:0;
$actioncomm->user = $user; $actioncomm->user = $user;
if (isset($_POST["contactid"])) if (isset($_POST["contactid"]))
{ {
$actioncomm->contact = $contact; $actioncomm->contact = $contact;
@ -104,6 +98,7 @@ if ($_POST["action"] == 'add_action')
} }
$actioncomm->note = $_POST["note"]; $actioncomm->note = $_POST["note"];
// On definit la ressource webcal si le module webcal est actif // On definit la ressource webcal si le module webcal est actif
$webcal=0; $webcal=0;
if ($conf->webcal->enabled && $_POST["todo_webcal"] == 'on') if ($conf->webcal->enabled && $_POST["todo_webcal"] == 'on')
@ -120,24 +115,24 @@ if ($_POST["action"] == 'add_action')
} }
else else
{ {
if ($_POST["actionid"] == 5) // Initialisation donnees webcal
if ($_POST["actionid"] == 5 && $contact->fullname)
{ {
$libellecal = $langs->trans("TaskRDVWith",$contact->fullname); $libellecal =$langs->trans("TaskRDVWith",$contact->fullname)."\n";
$libellecal .= "\n" . $actioncomm->label; $libellecal.=$actioncomm->label;
} }
else else
{ {
$libellecal = $actioncomm->label; $libellecal="";
if ($langs->trans("Action".$actioncomm->type_code) != "Action".$actioncomm->type_code)
{
$libellecal.=$langs->trans("Action".$actioncomm->type_code)."\n";
}
$libellecal.=$actioncomm->label;
} }
$webcal->date=mktime($_POST["heurehour"], $webcal->date=$actioncomm->date;
$_POST["heuremin"], $webcal->duree=($_POST["dureehour"] * 60) + $_POST["dureemin"];
0,
$_POST["acmonth"],
$_POST["acday"],
$_POST["acyear"]);
$webcal->heure = $_POST["heurehour"] . $_POST["heuremin"] . '00';
$webcal->duree = ($_POST["dureehour"] * 60) + $_POST["dureemin"];
$webcal->texte=$societe->nom; $webcal->texte=$societe->nom;
$webcal->desc=$libellecal; $webcal->desc=$libellecal;
} }
@ -208,11 +203,14 @@ if ($_POST["action"] == 'update')
$action->fetch($_POST["id"]); $action->fetch($_POST["id"]);
$action->percent = $_POST["percent"]; $action->percent = $_POST["percent"];
$action->contact->id = $_POST["contactid"]; $action->contact->id = $_POST["contactid"];
$action->note = $_POST["note"];
$action->update(); $action->update();
Header("Location: ".$_POST["from"]); Header("Location: ".$_POST["from"]);
} }
llxHeader(); llxHeader();
$html = new Form($db); $html = new Form($db);
@ -343,7 +341,7 @@ if ($_GET["action"] == 'create')
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" size="30"></td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="30"></td></tr>';
// Societe, contact // Societe, contact
print '<tr><td nowrap>'.$langs->trans("ActionOnCompany").'</td><td>'; print '<tr><td nowrap>'.$langs->trans("ActionOnCompany").'</td><td>';
@ -470,7 +468,7 @@ if ($_GET["id"])
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>'; print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$act->libelle.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td>'; print '<tr><td>'.$langs->trans("Company").'</td>';
print '<td><a href="../fiche.php?socid='.$act->societe->id.'">'.$act->societe->nom.'</a></td>'; print '<td><a href="../fiche.php?socid='.$act->societe->id.'">'.$act->societe->nom.'</a></td>';
@ -486,11 +484,10 @@ if ($_GET["id"])
print '<td colspan="3">'.$act->objet_url.'</td></tr>'; print '<td colspan="3">'.$act->objet_url.'</td></tr>';
} }
if ($act->note) // Note
{
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
print nl2br($act->note).'</td></tr>'; print '<textarea cols="60" rows="6" name="note">'.nl2br($act->note).'</textarea></td></tr>';
}
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Save").'"</td></tr>'; print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Save").'"</td></tr>';
print '</table></form>'; print '</table></form>';
} }
@ -499,7 +496,7 @@ if ($_GET["id"])
// Affichage fiche action en mode visu // Affichage fiche action en mode visu
print '<table class="border" width="100%"'; print '<table class="border" width="100%"';
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>'; print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$act->libelle.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td>'; print '<tr><td>'.$langs->trans("Company").'</td>';
print '<td>'.$act->societe->nom_url.'</td>'; print '<td>'.$act->societe->nom_url.'</td>';
@ -514,11 +511,10 @@ if ($_GET["id"])
print '<td colspan="3">'.$act->objet_url.'</td></tr>'; print '<td colspan="3">'.$act->objet_url.'</td></tr>';
} }
if ($act->note) // Note
{
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
print nl2br($act->note).'</td></tr>'; print nl2br($act->note).'</td></tr>';
}
print '</table>'; print '</table>';
} }
print '<br>'; print '<br>';

View File

@ -29,10 +29,9 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require_once("../../contact.class.php");
require("../../contact.class.php"); require_once("../../actioncomm.class.php");
require("../../actioncomm.class.php");
$langs->load("companies"); $langs->load("companies");

View File

@ -28,10 +28,9 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require_once("../../../contact.class.php");
require("../../../contact.class.php"); require_once("../../../actioncomm.class.php");
require("../../../actioncomm.class.php");
/* /*
* Sécurité accés client * Sécurité accés client
@ -49,81 +48,21 @@ if ($_GET["action"] == 'pdf')
} }
llxHeader();
/* /*
* * Actions
*
*
*/ */
if ($action=='delete_action') if ($action=='delete_action')
{ {
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->delete($actionid); $actioncomm->delete($actionid);
} }
/*
*
*/
if ($action=='add_action')
{
$contact = new Contact($db);
$contact->fetch($contactid);
$actioncomm = new ActionComm($db);
if ($actionid == 5)
{
$actioncomm->date = $db->idate(mktime($heurehour,$heuremin,0,$remonth,$reday,$reyear));
}
else
{
$actioncomm->date = $date;
}
$actioncomm->type = $actionid;
$actioncomm->contact = $contactid;
$actioncomm->societe = $socid;
$actioncomm->note = $note;
$actioncomm->add($user);
$societe = new Societe($db);
$societe->fetch($socid);
$todo = new TodoComm($db);
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
$todo->libelle = $todo_label; llxHeader();
$todo->societe = $societe->id;
$todo->contact = $contactid;
$todo->note = $todo_note;
$todo->add($user);
$webcal = new Webcal();
$webcal->heure = $heurehour . $heuremin . '00';
$webcal->duree = ($dureehour * 60) + $dureemin;
if ($actionid == 5) {
$libelle = "Rendez-vous avec ".$contact->fullname;
$libelle .= "\n" . $todo->libelle;
} else {
$libelle = $todo->libelle;
}
$webcal->add($user, $todo->date, $societe->nom, $libelle);
}
/* /*
*
* Liste * Liste
*
*/ */
if ($page == -1) { $page = 0 ; } if ($page == -1) { $page = 0 ; }
@ -155,7 +94,7 @@ if ( $db->query($sql) )
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>Date</td>'; print '<td>'.$langs->trans("Date").'</td>';
print '<td align="center">'.$langs->trans("Nb").'</td>'; print '<td align="center">'.$langs->trans("Nb").'</td>';
print '<td>'.$langs->trans("Action").'</td>'; print '<td>'.$langs->trans("Action").'</td>';
print '<td align="center">'.$langs->trans("PDF").'</td>'; print '<td align="center">'.$langs->trans("PDF").'</td>';
@ -206,5 +145,5 @@ else
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -173,7 +173,7 @@ if ($_POST['action'] == 'send')
if ($_POST['action'] == 'send') if ($_POST['action'] == 'send')
{ {
$subject = $langs->trans('Propal').' '.$propal->ref; $subject = $langs->trans('Propal').' '.$propal->ref;
$actioncode=3; $actiontypeid=3;
$actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>'; $actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>';
if ($message) if ($message)
{ {
@ -186,7 +186,7 @@ if ($_POST['action'] == 'send')
if ($_POST["action"] == 'relance') if ($_POST["action"] == 'relance')
{ {
$subject = "Relance facture $propal->ref"; $subject = "Relance facture $propal->ref";
$actioncode=10; $actiontypeid=10;
$actionmsg="Mail envoyé par $from à $sendto.<br>"; $actionmsg="Mail envoyé par $from à $sendto.<br>";
if ($message) if ($message)
{ {
@ -210,10 +210,10 @@ if ($_POST['action'] == 'send')
// Insertion action // Insertion action
include_once('../contact.class.php'); include_once('../contact.class.php');
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->type_code = $actioncode; $actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2; $actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg; $actioncomm->note = $actionmsg;
$actioncomm->date = $db->idate(time()); $actioncomm->date = time(); // L'action est faite maintenant
$actioncomm->percent = 100; $actioncomm->percent = 100;
$actioncomm->contact = new Contact($db,$sendtoid); $actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$propal->socidp); $actioncomm->societe = new Societe($db,$propal->socidp);

View File

@ -28,9 +28,9 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require("../../contact.class.php"); require_once("../../contact.class.php");
require("../../actioncomm.class.php"); require_once("../../actioncomm.class.php");
$langs->load('companies'); $langs->load('companies');
$langs->load('projects'); $langs->load('projects');

View File

@ -18,7 +18,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -28,10 +27,10 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require("../contact.class.php"); require_once("../contact.class.php");
require("../cactioncomm.class.php"); //require_once("../cactioncomm.class.php");
require("../actioncomm.class.php"); //require_once("../actioncomm.class.php");
$user->getrights('propale'); $user->getrights('propale');
$user->getrights('commande'); $user->getrights('commande');
@ -210,7 +209,8 @@ if ($_socid > 0)
$sql .= " AND u.rowid = rc.fk_user_author"; $sql .= " AND u.rowid = rc.fk_user_author";
$sql .= " ORDER BY rc.datec DESC"; $sql .= " ORDER BY rc.datec DESC";
if ( $db->query($sql) ) $resql=$db->query($sql);
if ($resql)
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$tag = !$tag; $tag = !$tag;
@ -220,11 +220,11 @@ if ($_socid > 0)
print '<td>'.$langs->trans("User").'</td>'; print '<td>'.$langs->trans("User").'</td>';
print '</tr>'; print '</tr>';
$i = 0 ; $i = 0 ;
$num = $db->num_rows(); $num = $db->num_rows($resql);
while ($i < $num ) while ($i < $num )
{ {
$obj = $db->fetch_object( $i); $obj = $db->fetch_object($resql);
$tag = !$tag; $tag = !$tag;
print '<tr '.$bc[$tag].'>'; print '<tr '.$bc[$tag].'>';
print '<td>'.dolibarr_print_date($obj->dc,"%d %B %Y %H:%M").'</td>'; print '<td>'.dolibarr_print_date($obj->dc,"%d %B %Y %H:%M").'</td>';
@ -233,7 +233,7 @@ if ($_socid > 0)
print '</tr>'; print '</tr>';
$i++; $i++;
} }
$db->free(); $db->free($resql);
print "</table>"; print "</table>";
} }
else else
@ -245,5 +245,5 @@ if ($_socid > 0)
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -18,12 +18,19 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php");
require("../contact.class.php"); /**
require("../cactioncomm.class.php"); \file htdocs/comm/remx.php
require("../actioncomm.class.php"); \ingroup commercial
\brief Onglet ???
\version $Revision$
*/
require_once("./pre.inc.php");
require_once("../contact.class.php");
//require_once("../cactioncomm.class.php");
//require_once("../actioncomm.class.php");
$user->getrights('propale'); $user->getrights('propale');
$user->getrights('commande'); $user->getrights('commande');

View File

@ -28,9 +28,9 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require("../contact.class.php"); require_once("../contact.class.php");
require("../actioncomm.class.php"); require_once("../actioncomm.class.php");
if ($conf->webcal->enabled) { if ($conf->webcal->enabled) {
require("../lib/webcal.class.php"); require("../lib/webcal.class.php");
@ -59,45 +59,6 @@ if ($user->societe_id > 0)
$socidp = $user->societe_id; $socidp = $user->societe_id;
} }
// \todo code encore utilisé ?
if ($action=='add_action') {
/*
* Vient de actioncomm.php
*
*/
$actioncomm = new ActionComm($db);
$actioncomm->date = $date;
$actioncomm->type = $actionid;
$actioncomm->contact = $contactid;
$actioncomm->societe = $socid;
$actioncomm->note = $note;
$actioncomm->add($user);
$societe = new Societe($db);
$societe->fetch($socid);
$todo = new TodoComm($db);
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
$todo->libelle = $todo_label;
$todo->societe = $societe->id;
$todo->contact = $contactid;
$todo->note = $todo_note;
$todo->add($user);
$webcal = new Webcal();
$webcal->add($user, $todo->date, $societe->nom, $todo->libelle);
}
if ($action == 'attribute_prefix') if ($action == 'attribute_prefix')
{ {
$societe = new Societe($db, $socid); $societe = new Societe($db, $socid);

View File

@ -382,7 +382,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
$message = $_POST["message"]; $message = $_POST["message"];
if ($_POST["action"] == 'send') { if ($_POST["action"] == 'send') {
$subject = $langs->trans("Bill")." $fac->ref"; $subject = $langs->trans("Bill")." $fac->ref";
$actioncode=9; $actiontypeid=9;
$actionmsg ="Mail envoyé par $from à $sendto.<br>"; $actionmsg ="Mail envoyé par $from à $sendto.<br>";
if ($message) { if ($message) {
$actionmsg.="Texte utilisé dans le corps du message:<br>"; $actionmsg.="Texte utilisé dans le corps du message:<br>";
@ -392,7 +392,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
} }
if ($_POST["action"] == 'relance') { if ($_POST["action"] == 'relance') {
$subject = "Relance facture $fac->ref"; $subject = "Relance facture $fac->ref";
$actioncode=10; $actiontypeid=10;
$actionmsg="Mail envoyé par $from à $sendto.<br>"; $actionmsg="Mail envoyé par $from à $sendto.<br>";
if ($message) { if ($message) {
$actionmsg.="Texte utilisé dans le corps du message:<br>"; $actionmsg.="Texte utilisé dans le corps du message:<br>";
@ -419,10 +419,10 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
include_once("../contact.class.php"); include_once("../contact.class.php");
include_once("../actioncomm.class.php"); include_once("../actioncomm.class.php");
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->type_code = $actioncode; $actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2; $actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg; $actioncomm->note = $actionmsg;
$actioncomm->date = $db->idate(time()); $actioncomm->date = time();
$actioncomm->percent = 100; $actioncomm->percent = 100;
$actioncomm->contact = new Contact($db,$sendtoid); $actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$fac->socidp); $actioncomm->societe = new Societe($db,$fac->socidp);

View File

@ -53,26 +53,6 @@ $user->getrights('facture');
llxHeader(); llxHeader();
if ($action=='add_action')
{
/*
* Vient de actioncomm.php
*
*/
$actioncomm = new ActionComm($db);
$actioncomm->date = $date;
$actioncomm->type = $actionid;
$actioncomm->contact = $contactid;
$actioncomm->societe = $socid;
$actioncomm->note = $note;
$actioncomm->add($user);
$societe = new Societe($db);
$societe->fetch($socid);
}
if ($action == 'recontact') if ($action == 'recontact')
{ {

View File

@ -38,7 +38,7 @@ accessforbidden();
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
require_once("../project.class.php"); require_once("../project.class.php");
require_once("../propal.class.php"); require_once("../propal.class.php");
require_once("../actioncomm.class.php"); //require_once("../actioncomm.class.php");
// Sécurité accés client // Sécurité accés client
if ($user->societe_id > 0) if ($user->societe_id > 0)

View File

@ -245,6 +245,7 @@ WebCalSetupSaved=Webcalendar setup saved successfully.
WebCalTestOk=Connection to server '%s' on database '%s' with user '%s' successfull. WebCalTestOk=Connection to server '%s' on database '%s' with user '%s' successfull.
WebCalTestKo1=Connection to server '%s' succeed but database '%s' could not be reached. WebCalTestKo1=Connection to server '%s' succeed but database '%s' could not be reached.
WebCalTestKo2=Connection to server '%s' with user '%s' failed. WebCalTestKo2=Connection to server '%s' with user '%s' failed.
ErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be a Webcalendar database.
##### Bills ##### ##### Bills #####
BillsSetup=Bills module setup BillsSetup=Bills module setup
BillsDate=Bills date BillsDate=Bills date

View File

@ -17,6 +17,7 @@ ErrorAttachedFilesDisabled=Attaching files feature is disabled on this serveur
ErrorFileNotUploaded=File was not uploaded ErrorFileNotUploaded=File was not uploaded
ErrorInternalErrorDetected=Internal error detected ErrorInternalErrorDetected=Internal error detected
ErrorNoRequestRan=No request ran ErrorNoRequestRan=No request ran
ErrorWrongHostParameter=Wrong host parameter
RequestedUrl=Requested Url RequestedUrl=Requested Url
DatabaseTypeManager=Database type manager DatabaseTypeManager=Database type manager
RequestLastAccess=Request for last database access RequestLastAccess=Request for last database access
@ -81,6 +82,7 @@ Type=Type
Language=Language Language=Language
Note=Note Note=Note
CurrentNote=Current note CurrentNote=Current note
Title=Titre
Label=Label Label=Label
Info=Info Info=Info
Family=Family Family=Family

View File

@ -245,6 +245,7 @@ WebCalSetupSaved=Les identifiants Webcalendar ont
WebCalTestOk=La connexion au serveur '%s' sur la base '%s' par l'utilisateur '%s' a réussi. WebCalTestOk=La connexion au serveur '%s' sur la base '%s' par l'utilisateur '%s' a réussi.
WebCalTestKo1=La connexion au serveur '%s' a réussi mais la base '%s' n'a pu être atteinte. WebCalTestKo1=La connexion au serveur '%s' a réussi mais la base '%s' n'a pu être atteinte.
WebCalTestKo2=La connexion au serveur '%s' par l'utilisateur '%s' à échoué. WebCalTestKo2=La connexion au serveur '%s' par l'utilisateur '%s' à échoué.
ErrorConnectOkButWrongDatabase=La connexion a réussie mais la base ne semble pas etre une base webcalendar.
##### Bills ##### ##### Bills #####
BillsSetup=Configuration du module Factures BillsSetup=Configuration du module Factures
BillsDate=Date des factures BillsDate=Date des factures

View File

@ -17,6 +17,7 @@ ErrorAttachedFilesDisabled=La gestion des fichiers associ
ErrorFileNotUploaded=Le fichier n'a pas été transféré ErrorFileNotUploaded=Le fichier n'a pas été transféré
ErrorInternalErrorDetected=Erreur interne détectée ErrorInternalErrorDetected=Erreur interne détectée
ErrorNoRequestRan=Aucune requête exécutée ErrorNoRequestRan=Aucune requête exécutée
ErrorWrongHostParameter=Mauvais paramètre Serveur
RequestedUrl=Url sollicitée RequestedUrl=Url sollicitée
DatabaseTypeManager=Type gestionnaire de base de donnée DatabaseTypeManager=Type gestionnaire de base de donnée
RequestLastAccess=Requete dernier acces en base RequestLastAccess=Requete dernier acces en base
@ -81,6 +82,7 @@ Type=Type
Language=Langue Language=Langue
Note=Note Note=Note
CurrentNote=Note actuelle CurrentNote=Note actuelle
Title=Titre
Label=Libellé Label=Libellé
Info=Info Info=Info
Family=Famille Family=Famille

View File

@ -40,9 +40,9 @@ require_once (DOL_DOCUMENT_ROOT ."/lib/".$conf->webcal->db->type.".lib.php");
class Webcal { class Webcal {
var $localdb; var $localdb;
var $heure = -1;
var $duree = 0;
var $date; var $date;
var $duree = 0;
var $texte; var $texte;
var $desc; var $desc;
var $error; var $error;
@ -68,7 +68,7 @@ class Webcal {
/** /**
\brief Ajoute une entree dans le calendrier de l'utilisateur \brief Ajoute une entree dans le calendrier de l'utilisateur
\param[in] user le login de l'utilisateur \param[in] user le login de l'utilisateur
\param[in] date la date de l'evenement dans le calendrier \param[in] date la date et l'heure de l'evenement dans le calendrier
\param[in] texte le titre a indiquer dans l'evenement \param[in] texte le titre a indiquer dans l'evenement
\param[in] desc la description a indiquer dans l'evenement \param[in] desc la description a indiquer dans l'evenement
\return int 1 en cas de succès, -1,-2,-3 en cas d'erreur, -4 si login webcal non défini \return int 1 en cas de succès, -1,-2,-3 en cas d'erreur, -4 si login webcal non défini
@ -93,9 +93,9 @@ class Webcal {
$cal_id = $id; $cal_id = $id;
$cal_create_by = $user->webcal_login; $cal_create_by = $user->webcal_login;
$cal_date = strftime('%Y%m%d', $date); $cal_date = strftime('%Y%m%d', $date);
$cal_time = $this->heure; $cal_time = strftime('%H%M%S', $date);
$cal_mod_date = strftime('%Y%m%d', time()); $cal_mod_date = strftime('%Y%m%d', time());
$cal_mod_time = strftime('%H%M', time()); $cal_mod_time = strftime('%H%M%S', time());
$cal_duration = $this->duree; $cal_duration = $this->duree;
$cal_priority = 2; $cal_priority = 2;
$cal_type = "E"; $cal_type = "E";
@ -106,7 +106,7 @@ class Webcal {
$sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date, $sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date,
cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)"; cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)";
$sql .= " VALUES ($cal_id, '$cal_create_by', $cal_date, $cal_time,$cal_mod_date, $cal_mod_time, $sql .= " VALUES ($cal_id, '$cal_create_by', '$cal_date', '$cal_time', '$cal_mod_date', '$cal_mod_time',
$cal_duration,$cal_priority,'$cal_type', '$cal_access', '$cal_name','$cal_description')"; $cal_duration,$cal_priority,'$cal_type', '$cal_access', '$cal_name','$cal_description')";
if ($this->localdb->query($sql)) if ($this->localdb->query($sql))

View File

@ -27,10 +27,10 @@
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require_once("./pre.inc.php");
require("./contact.class.php"); require_once("./contact.class.php");
require("./cactioncomm.class.php"); //require_once("./cactioncomm.class.php");
require("./actioncomm.class.php"); //require_once("./actioncomm.class.php");
$langs->load("companies"); $langs->load("companies");
$langs->load("customers"); $langs->load("customers");