Enhancement of actions

This commit is contained in:
Laurent Destailleur 2008-04-15 08:34:36 +00:00
parent 2ca2e35a44
commit f563578b4f
7 changed files with 237 additions and 151 deletions

View File

@ -37,6 +37,7 @@ $langs->load("commercial");
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
// Securite acces client // Securite acces client
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -46,6 +47,10 @@ if ($user->societe_id > 0)
} }
if (isset($_GET["error"])) $error=$_GET["error"]; if (isset($_GET["error"])) $error=$_GET["error"];
$cactioncomm = new CActionComm($db);
$actioncomm = new ActionComm($db);
$contact = new Contact($db);
/* /*
* Action creation de l'action * Action creation de l'action
@ -55,7 +60,6 @@ if ($_POST["action"] == 'add_action')
{ {
if ($_POST["contactid"]) if ($_POST["contactid"])
{ {
$contact = new Contact($db);
$result=$contact->fetch($_POST["contactid"]); $result=$contact->fetch($_POST["contactid"]);
} }
@ -71,6 +75,10 @@ if ($_POST["action"] == 'add_action')
if ($_POST["apmin"] == -1) $_POST["apmin"]='0'; if ($_POST["apmin"] == -1) $_POST["apmin"]='0';
if ($_POST["adhour"] == -1) $_POST["adhour"]='0'; if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
if ($_POST["admin"] == -1) $_POST["admin"]='0'; if ($_POST["admin"] == -1) $_POST["admin"]='0';
if ($_POST["p2hour"] == -1) $_POST["p2hour"]='0';
if ($_POST["p2min"] == -1) $_POST["p2min"]='0';
if ($_POST["a2hour"] == -1) $_POST["a2hour"]='0';
if ($_POST["a2min"] == -1) $_POST["a2min"]='0';
$datep=dolibarr_mktime($_POST["aphour"], $datep=dolibarr_mktime($_POST["aphour"],
$_POST["apmin"], $_POST["apmin"],
0, 0,
@ -83,17 +91,103 @@ if ($_POST["action"] == 'add_action')
$_POST["admonth"], $_POST["admonth"],
$_POST["adday"], $_POST["adday"],
$_POST["adyear"]); $_POST["adyear"]);
$datep2=dolibarr_mktime($_POST["p2hour"],
$_POST["p2min"],
0,
$_POST["p2month"],
$_POST["p2day"],
$_POST["p2year"]);
$datea2=dolibarr_mktime($_POST["a2hour"],
$_POST["a2min"],
0,
$_POST["a2month"],
$_POST["a2day"],
$_POST["a2year"]);
// Si param incorrects, mktime renvoi false en PHP 5.1, -1 avant // Si param incorrects, mktime renvoi false en PHP 5.1, -1 avant
if (! ($datep > 0)) $datep=''; if (! ($datep > 0)) $datep='';
if (! ($datea > 0)) $datea=''; if (! ($datea > 0)) $datea='';
if (! ($datep2 > 0)) $datep2='';
if (! ($datea2 > 0)) $datea2='';
// Initialisation objet cactioncomm
if (! $_POST["actioncode"]) if (! $_POST["actioncode"])
{ {
$error=1; $error=1;
$_GET["action"] = 'create'; $_GET["action"] = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'</div>';
} }
else
{
$result=$cactioncomm->fetch($_POST["actioncode"]);
}
// Initialisation objet actioncomm
$actioncomm->type_id = $cactioncomm->id;
$actioncomm->type_code = $cactioncomm->code;
$actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0;
$actioncomm->label = trim($_POST["label"]);
if (! $_POST["label"])
{
if ($_POST["actioncode"] == 'AC_RDV' && $contact->getFullName($langs))
{
$actioncomm->label = $langs->trans("TaskRDVWith",$contact->getFullName($langs));
}
else
{
if ($langs->trans("Action".$actioncomm->type_code) != "Action".$actioncomm->type_code)
{
$actioncomm->label = $langs->trans("Action".$actioncomm->type_code)."\n";
}
}
}
$actioncomm->datep = $datep;
$actioncomm->date = $datea;
$actioncomm->datef = $datep2;
$actioncomm->dateend = $datea2;
if ($_POST["percentage"] < 100 && ! $actioncomm->datep) $actioncomm->datep=$actioncomm->date;
if ($actioncomm->type_code == 'AC_RDV')
{
// RDV
if ($actioncomm->date)
{
$actioncomm->percentage = 100;
}
else
{
$actioncomm->percentage = 0;
}
}
else
{
$actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0;
}
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
$usertodo=new User($db,$_POST["affectedto"]);
if ($_POST["affectedto"])
{
$usertodo->fetch();
}
$actioncomm->usertodo = $usertodo;
$userdone=new User($db,$_POST["doneby"]);
if ($_POST["doneby"])
{
$userdone->fetch();
}
$actioncomm->userdone = $userdone;
$actioncomm->note = trim($_POST["note"]);
if (isset($_POST["contactid"])) $actioncomm->contact = $contact;
if (isset($_REQUEST["socid"]) && $_REQUEST["socid"] > 0)
{
$societe = new Societe($db);
$societe->fetch($_REQUEST["socid"]);
$actioncomm->societe = $societe;
}
if ($_POST["add_webcal"] == 'on' && $conf->webcal->enabled) $actioncomm->use_webcal=1;
if ($_POST["add_phenix"] == 'on' && $conf->phenix->enabled) $actioncomm->use_phenix=1;
if ($datea && $_POST["percentage"] == 0) if ($datea && $_POST["percentage"] == 0)
{ {
$error=1; $error=1;
@ -112,77 +206,7 @@ if ($_POST["action"] == 'add_action')
{ {
$db->begin(); $db->begin();
$cactioncomm = new CActionComm($db); // On cree l'action
$cactioncomm->fetch($_POST["actioncode"]);
// Initialisation objet actioncomm
$actioncomm = new ActionComm($db);
$actioncomm->type_id = $cactioncomm->id;
$actioncomm->type_code = $cactioncomm->code;
$actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0;
$actioncomm->label = trim($_POST["label"]);
if (! $_POST["label"])
{
if ($_POST["actioncode"] == 'AC_RDV' && $contact->getFullName($langs))
{
$actioncomm->label = $langs->trans("TaskRDVWith",$contact->getFullName($langs));
}
else
{
if ($langs->trans("Action".$actioncomm->type_code) != "Action".$actioncomm->type_code)
{
$actioncomm->label = $langs->trans("Action".$actioncomm->type_code)."\n";
}
}
}
// print $_POST["aphour"]." ".$_POST["apmin"]." ".$_POST["apday"];
$actioncomm->datep = $datep;
$actioncomm->date = $datea;
if ($_POST["percentage"] < 100 && ! $actioncomm->datep) $actioncomm->datep=$actioncomm->date;
if ($actioncomm->type_code == 'AC_RDV')
{
// RDV
if ($actioncomm->date)
{
$actioncomm->percentage = 100;
}
else
{
$actioncomm->percentage = 0;
}
}
else
{
$actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0;
}
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
$usertodo=new User($db,$_POST["affectedto"]);
if ($_POST["affectedto"])
{
$usertodo->fetch();
}
$actioncomm->usertodo = $usertodo;
$userdone=new User($db,$_POST["doneby"]);
if ($_POST["doneby"])
{
$userdone->fetch();
}
$actioncomm->userdone = $userdone;
$actioncomm->note = trim($_POST["note"]);
if (isset($_POST["contactid"])) $actioncomm->contact = $contact;
if (isset($_REQUEST["socid"]) && $_REQUEST["socid"] > 0)
{
$societe = new Societe($db);
$societe->fetch($_REQUEST["socid"]);
$actioncomm->societe = $societe;
}
if ($_POST["add_webcal"] == 'on' && $conf->webcal->enabled) $actioncomm->use_webcal=1;
if ($_POST["add_phenix"] == 'on' && $conf->phenix->enabled) $actioncomm->use_phenix=1;
// On cr<63>e l'action
$idaction=$actioncomm->add($user); $idaction=$actioncomm->add($user);
if ($idaction > 0) if ($idaction > 0)
@ -260,21 +284,43 @@ if ($_POST["action"] == 'update')
$actioncomm = new Actioncomm($db); $actioncomm = new Actioncomm($db);
$actioncomm->fetch($_POST["id"]); $actioncomm->fetch($_POST["id"]);
$actioncomm->datep = dolibarr_mktime($_POST["aphour"], $datep=dolibarr_mktime($_POST["aphour"],
$_POST["apmin"], $_POST["apmin"],
0, 0,
$_POST["apmonth"], $_POST["apmonth"],
$_POST["apday"], $_POST["apday"],
$_POST["apyear"]); $_POST["apyear"]);
$actioncomm->date = dolibarr_mktime($_POST["adhour"], $datea=dolibarr_mktime($_POST["adhour"],
$_POST["admin"], $_POST["admin"],
0, 0,
$_POST["admonth"], $_POST["admonth"],
$_POST["adday"], $_POST["adday"],
$_POST["adyear"]); $_POST["adyear"]);
$datep2=dolibarr_mktime($_POST["p2hour"],
$_POST["p2min"],
0,
$_POST["p2month"],
$_POST["p2day"],
$_POST["p2year"]);
$datea2=dolibarr_mktime($_POST["a2hour"],
$_POST["a2min"],
0,
$_POST["a2month"],
$_POST["a2day"],
$_POST["a2year"]);
// Si param incorrects, mktime renvoi false en PHP 5.1, -1 avant
if (! ($datep > 0)) $datep='';
if (! ($datea > 0)) $datea='';
if (! ($datep2 > 0)) $datep2='';
if (! ($datea2 > 0)) $datea2='';
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n"; //print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n";
//print $actioncomm->datep; //print $actioncomm->datep;
$actioncomm->label = $_POST["label"]; $actioncomm->label = $_POST["label"];
$actioncomm->datep = $datep;
$actioncomm->date = $datea;
$actioncomm->datef = $datep2;
$actioncomm->dateend = $datea2;
$actioncomm->percentage = $_POST["percentage"]; $actioncomm->percentage = $_POST["percentage"];
$actioncomm->priority = $_POST["priority"]; $actioncomm->priority = $_POST["priority"];
$actioncomm->contact->id = $_POST["contactid"]; $actioncomm->contact->id = $_POST["contactid"];
@ -334,8 +380,6 @@ $html = new Form($db);
if ($_GET["action"] == 'create') if ($_GET["action"] == 'create')
{ {
$caction = new CActioncomm($db);
if ($_GET["contactid"]) if ($_GET["contactid"])
{ {
$contact = new Contact($db); $contact = new Contact($db);
@ -353,9 +397,9 @@ if ($_GET["action"] == 'create')
if ($_GET["actioncode"] == 'AC_RDV') if ($_GET["actioncode"] == 'AC_RDV')
{ {
print_titre ($langs->trans("AddActionRendezVous")); print_titre ($langs->trans("AddActionRendezVous"));
print "<br>";
if ($mesg) print $mesg.'<br>'; if ($mesg) print $mesg.'<br>';
else print "<br>";
print '<input type="hidden" name="date" value="'.$db->idate(time()).'">'."\n"; print '<input type="hidden" name="date" value="'.$db->idate(time()).'">'."\n";
@ -398,28 +442,30 @@ if ($_GET["action"] == 'create')
$html->select_users($_REQUEST["doneby"],'doneby',1); $html->select_users($_REQUEST["doneby"],'doneby',1);
print '</td></tr>'; print '</td></tr>';
// Date planification // Date start planed
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>'; print '<tr><td nowrap="nowrap">'.$langs->trans("DateActionPlannedStart").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datea,'ap',1,1,0,"action");
{ else if ($_REQUEST["afaire"] == 2) $html->select_date('','ap',1,1,1,"action");
$html->select_date(-1,'ap',1,1,1,"action"); else $html->select_date('','ap',1,1,1,"action");
} print '</td></tr>';
else // Date end planed
{ print '<tr><td>'.$langs->trans("DateActionPlannedEnd").'</td><td>';
$html->select_date(-1,'ap',1,1,1,"action"); if ($_REQUEST["afaire"] == 1) $html->select_date('','p2',1,1,1,"action");
} else if ($_REQUEST["afaire"] == 2) $html->select_date('','p2',1,1,1,"action");
else $html->select_date('','p2',1,1,1,"action");
print '</td></tr>'; print '</td></tr>';
// Date done // Date start done
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionDoneStart").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_REQUEST["afaire"] == 1) $html->select_date('','ad',1,1,1,"action");
{ else if ($_REQUEST["afaire"] == 2) $html->select_date('','ad',1,1,0,"action");
$html->select_date(-1,'ad',1,1,1,"action"); else $html->select_date('','ad',1,1,1,"action");
} print '</td></tr>';
else // Date end done
{ print '<tr><td>'.$langs->trans("DateActionDoneEnd").'</td><td>';
$html->select_date(-1,'ad',1,1,1,"action"); if ($_REQUEST["afaire"] == 1) $html->select_date('','a2',1,1,1,"action");
} else if ($_REQUEST["afaire"] == 2) $html->select_date('','a2',1,1,0,"action");
else $html->select_date('','a2',1,1,1,"action");
print '</td></tr>'; print '</td></tr>';
// Duration // Duration
@ -459,10 +505,10 @@ if ($_GET["action"] == 'create')
else else
{ {
print_titre ($langs->trans("AddAnAction")); print_titre ($langs->trans("AddAnAction"));
print "<br>";
if ($mesg) print $mesg.'<br>'; if ($mesg) print $mesg.'<br>';
else print "<br>";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Type d'action actifs // Type d'action actifs
@ -475,15 +521,15 @@ if ($_GET["action"] == 'create')
} }
else else
{ {
$html->select_type_actions(0, "actioncode"); $html->select_type_actions($actioncomm->type_code, "actioncode");
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Title").'</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" value="'.$actioncomm->label.'"></td></tr>';
// Societe, contact // Societe, contact
print '<tr><td nowrap>'.$langs->trans("ActionOnCompany").'</td><td>'; print '<tr><td nowrap>'.$langs->trans("ActionOnCompany").'</td><td>';
if ($_REQUEST["socid"]) if ($_REQUEST["socid"] > 0)
{ {
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($_REQUEST["socid"]); $societe->fetch($_REQUEST["socid"]);
@ -497,7 +543,7 @@ if ($_GET["action"] == 'create')
print '</td></tr>'; print '</td></tr>';
// Si la societe est imposee, on propose ces contacts // Si la societe est imposee, on propose ces contacts
if ($_REQUEST["socid"]) if ($_REQUEST["socid"] > 0)
{ {
print '<tr><td nowrap>'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td nowrap>'.$langs->trans("ActionOnContact").'</td><td>';
$html->select_contacts($_REQUEST["socid"],'','contactid',1,1); $html->select_contacts($_REQUEST["socid"],'','contactid',1,1);
@ -506,22 +552,22 @@ if ($_GET["action"] == 'create')
// Affecte a // Affecte a
print '<tr><td nowrap>'.$langs->trans("ActionAffectedTo").'</td><td>'; print '<tr><td nowrap>'.$langs->trans("ActionAffectedTo").'</td><td>';
$html->select_users($_REQUEST["affectedto"],'affectedto',1); $html->select_users($_REQUEST["affectedto"]?$_REQUEST["affectedto"]:$actioncomm->usertodo,'affectedto',1);
print '</td></tr>'; print '</td></tr>';
// Realise par // Realise par
print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td>'; print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td>';
$html->select_users($_REQUEST["doneby"],'doneby',1); $html->select_users($_REQUEST["doneby"]?$_REQUEST["doneby"]:$actioncomm->userdone,'doneby',1);
print '</td></tr>'; print '</td></tr>';
// Avancement // Avancement
if ($_GET["afaire"] == 1) if ($_REQUEST["afaire"] == 1)
{ {
print '<input type="hidden" name="percentage" value="0">'; print '<input type="hidden" name="percentage" value="0">';
print '<input type="hidden" name="todo" value="on">'; print '<input type="hidden" name="todo" value="on">';
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td>'.$langs->trans("StatusActionToDo").' / 0%</td></tr>'; print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td>'.$langs->trans("StatusActionToDo").' / 0%</td></tr>';
} }
elseif ($_GET["afaire"] == 2) elseif ($_REQUEST["afaire"] == 2)
{ {
print '<input type="hidden" name="percentage" value="100">'; print '<input type="hidden" name="percentage" value="100">';
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td>'.$langs->trans("StatusActionDone").' / 100%</td></tr>'; print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td>'.$langs->trans("StatusActionDone").' / 100%</td></tr>';
@ -530,28 +576,30 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td><input type="text" name="percentage" value="0" size="4">%</td></tr>'; print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td><input type="text" name="percentage" value="0" size="4">%</td></tr>';
} }
// Date planification // Date start planed
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>'; print '<tr><td nowrap="nowrap">'.$langs->trans("DateActionPlannedStart").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datep,'ap',1,1,0,"action");
{ else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datep,'ap',1,1,1,"action");
$html->select_date('','ap',1,1,0,"action"); else $html->select_date($actioncomm->datep,'ap',1,1,1,"action");
} print '</td></tr>';
else // Date end planed
{ print '<tr><td>'.$langs->trans("DateActionPlannedEnd").'</td><td>';
$html->select_date('','ap',1,1,0,"action"); if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datef,'p2',1,1,1,"action");
} else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datef,'p2',1,1,1,"action");
else $html->select_date($actioncomm->datef,'p2',1,1,1,"action");
print '</td></tr>'; print '</td></tr>';
// Date done // Date start done
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionDoneStart").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->date,'ad',1,1,1,"action");
{ else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->date,'ad',1,1,0,"action");
$html->select_date(-1,'ad',1,1,1,"action"); else $html->select_date($actioncomm->date,'ad',1,1,1,"action");
} print '</td></tr>';
elseif ($_GET["afaire"] != 1) // Date end done
{ print '<tr><td>'.$langs->trans("DateActionDoneEnd").'</td><td>';
$html->select_date(-1,'ad',1,1,1,"action"); if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->dateend,'a2',1,1,1,"action");
} else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->dateend,'a2',1,1,0,"action");
else $html->select_date($actioncomm->dateend,'a2',1,1,1,"action");
print '</td></tr>'; print '</td></tr>';
add_row_for_calendar_link(); add_row_for_calendar_link();
@ -834,7 +882,7 @@ function add_row_for_calendar_link()
global $conf,$langs,$user; global $conf,$langs,$user;
$nbtr=0; $nbtr=0;
// Lien avec calendrier si module activ<EFBFBD> // Lien avec calendrier si module active
if ($conf->webcal->enabled) if ($conf->webcal->enabled)
{ {
if ($conf->global->PHPWEBCALENDAR_SYNCRO != 'never') if ($conf->global->PHPWEBCALENDAR_SYNCRO != 'never')

View File

@ -112,11 +112,16 @@ $next = dol_get_next_month($month, $year);
$next_year = $next['year']; $next_year = $next['year'];
$next_month = $next['month']; $next_month = $next['month'];
$max_day_in_month = date("t",dolibarr_mktime(0,0,0,$month,1,$year));
$max_day_in_prev_month = date("t",dolibarr_mktime(0,0,0,$prev_month,1,$prev_year)); $max_day_in_prev_month = date("t",dolibarr_mktime(0,0,0,$prev_month,1,$prev_year));
$max_day_in_month = date("t",dolibarr_mktime(0,0,0,$month,1,$year));
$day = -date("w",dolibarr_mktime(0,0,0,$month,1,$year))+2; $day = -date("w",dolibarr_mktime(0,0,0,$month,1,$year))+2;
if ($day > 1) $day -= 7; if ($day > 1) $day -= 7;
$firstdaytoshow=dolibarr_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$day,$prev_year);
$next_day=7-($max_day_in_month+1-$day)%7;
if ($next_day < 6) $next_day+=7;
$lastdaytoshow=dolibarr_mktime(0,0,0,$next_month,$next_day,$next_year);
//print dolibarr_print_date($firstdaytoshow,'day');
//print dolibarr_print_date($lastdaytoshow,'day');
$title=$langs->trans("DoneAndToDoActions"); $title=$langs->trans("DoneAndToDoActions");
if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'done') $title=$langs->trans("DoneActions");
@ -205,6 +210,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0)
} }
if ($status == 'done') { $sql.= " AND a.percent = 100"; } if ($status == 'done') { $sql.= " AND a.percent = 100"; }
if ($status == 'todo') { $sql.= " AND a.percent < 100"; } if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
// \TODO Add filters on dates
//echo "$sql<br>"; //echo "$sql<br>";
$actionarray=array(); $actionarray=array();
@ -224,23 +230,31 @@ if ($resql)
$action->libelle=$obj->label; $action->libelle=$obj->label;
$action->percentage=$obj->percent; $action->percentage=$obj->percent;
// Defined date_start_in_calendar and date_end_in_calendar property
if ($action->percentage <= 0) if ($action->percentage <= 0)
{ {
$action->date_to_show_in_calendar=$action->datep; $action->date_start_in_calendar=$action->datep;
// Add days until datep2 if ($action->datef != '' && $action->datef >= $action->datep) $action->date_end_in_calendar=$action->datef;
else $action->date_end_in_calendar=$action->datep;
} }
else if ($action->percentage > 0) else
{ {
$action->date_to_show_in_calendar=$action->date; $action->date_start_in_calendar=$action->date;
// Add days until dateend if ($action->dateend != '' && $action->dateend >= $action->date) $action->date_end_in_calendar=$action->dateend;
else $action->date_end_in_calendar=$action->date;
}
// Define ponctuel property
if ($action->date_start_in_calendar == $action->date_end_in_calendar)
{
$action->ponctuel=1;
} }
//var_dump($action); // Add an entry in action array for each day
$actionarray[]=$action; // \TODO
$daykey=$action->date_start_in_calendar;
$actionarray[$daykey]=$action;
$i++; $i++;
} }
//echo $num;
} }
else else
{ {
@ -323,15 +337,15 @@ function show_day_events($db, $day, $month, $year, $style, $actionarray)
//$curtime = dolibarr_mktime (0, 0, 0, $month, $day, $year); //$curtime = dolibarr_mktime (0, 0, 0, $month, $day, $year);
$i=0; $i=0;
foreach ($actionarray as $action) foreach ($actionarray as $daykey => $action)
{ {
$annee = date('Y',$action->date_to_show_in_calendar); $annee = date('Y',$action->date_start_in_calendar);
$mois = date('m',$action->date_to_show_in_calendar); $mois = date('m',$action->date_start_in_calendar);
$jour = date('d',$action->date_to_show_in_calendar); $jour = date('d',$action->date_start_in_calendar);
if ($day==$jour && $month==$mois && $year==$annee) if ($day==$jour && $month==$mois && $year==$annee)
{ {
if ($i) print "<br>"; if ($i) print "<br>";
print $action->getNomUrl(1,10)." ".$action->getLibStatut(3); print $action->getNomUrl(1,9).$action->getLibStatut(3);
$i++; $i++;
} }
} }

View File

@ -572,7 +572,7 @@ class Form
$arraylist[0]='&nbsp;'; $arraylist[0]='&nbsp;';
asort($arraylist); asort($arraylist);
$this->select_array($htmlname, $arraylist, 0); $this->select_array($htmlname, $arraylist, $selected);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
} }
@ -2728,7 +2728,7 @@ class Form
\brief Affiche un select à partir d'un tableau \brief Affiche un select à partir d'un tableau
\param htmlname Nom de la zone select \param htmlname Nom de la zone select
\param array Tableau de key+valeur \param array Tableau de key+valeur
\param id Key pré-sélectionnée \param id Preselected key
\param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon \param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon
\param key_in_label 1 pour afficher la key dans la valeur "[key] value" \param key_in_label 1 pour afficher la key dans la valeur "[key] value"
\param value_as_key 1 pour utiliser la valeur comme clé \param value_as_key 1 pour utiliser la valeur comme clé

View File

@ -120,6 +120,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
@ -138,6 +139,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("contracts"); $langs->load("contracts");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref);
@ -152,6 +154,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref);
@ -167,6 +170,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
@ -175,6 +179,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
@ -190,6 +195,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
@ -205,7 +211,8 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@ -220,6 +227,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
@ -228,6 +236,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
@ -243,6 +252,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
@ -251,6 +261,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("InvoicePayedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("InvoicePayedInDolibarr",$object->ref);
@ -266,6 +277,7 @@ class InterfaceActionsAuto
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);

View File

@ -25,4 +25,8 @@ ViewWithPredefinedFilters=View with predefined filters
AutoActions=Automatic creation of actions AutoActions=Automatic creation of actions
AgendaAutoActionDesc=Define here events for which you want Dolibarr to create automatically an action in agenda. If nothing is checked (by default), only manual actions will be included in agenda. AgendaAutoActionDesc=Define here events for which you want Dolibarr to create automatically an action in agenda. If nothing is checked (by default), only manual actions will be included in agenda.
AgendaSetupOtherDesc=This page allows to configure other parameters of agenda module. AgendaSetupOtherDesc=This page allows to configure other parameters of agenda module.
ActionsEvents=Events for which create an action ActionsEvents=Events for which create an action
PropalValidatedInDolibarr=Proposal validated
InvoiceValidatedInDolibarr=Invoice validated
OrderValidatedInDolibarr=Order validated
NewCompanyToDolibarr=Third party created

View File

@ -25,4 +25,12 @@ ViewWithPredefinedFilters=Vues avec filtres pr
AutoActions=Création automatiques des actions AutoActions=Création automatiques des actions
AgendaAutoActionDesc=Définissez dans cet onglet les évènements pour lesquels dolibarr créera automatiquement une action dans l'agenda. Si aucune case n'est cochée (par défaut), seules les actions manuelles seront incluses dans l'agenda. AgendaAutoActionDesc=Définissez dans cet onglet les évènements pour lesquels dolibarr créera automatiquement une action dans l'agenda. Si aucune case n'est cochée (par défaut), seules les actions manuelles seront incluses dans l'agenda.
AgendaSetupOtherDesc=Cette page permet de configurer les autres paramètres du module agenda. AgendaSetupOtherDesc=Cette page permet de configurer les autres paramètres du module agenda.
ActionsEvents=Evènements pour lesquels creer une action ActionsEvents=Evènements pour lesquels creer une action
PropalValidatedInDolibarr=Proposition validée
InvoiceValidatedInDolibarr=Facture validée
OrderValidatedInDolibarr=Commande validée
NewCompanyToDolibarr=Tiers créé
DateActionPlannedStart=Date début réalisation prévue
DateActionPlannedEnd=Date fin réalisation prévue
DateActionDoneStart=Date début réalisation réelle
DateActionDoneEnd=Date fin réalisation réelle

View File

@ -63,7 +63,7 @@ ActionAskedBy=Action enregistr
ActionAffectedTo=Action affectée à ActionAffectedTo=Action affectée à
ActionDoneBy=Action faite par ActionDoneBy=Action faite par
ActionUserAsk=Enregistré par ActionUserAsk=Enregistré par
ErrorStatusCantBeZeroIfStarted=Si le champ '<b>Date de réalisation</b>' est renseigné alors l'action est commencée voire finie, aussi le champ 'Etat' ne peut etre 0%%. ErrorStatusCantBeZeroIfStarted=Si le champ '<b>Date début réalisation réelle</b>' est renseigné alors l'action est commencée voire finie, aussi le champ 'Etat' ne peut etre 0%%.
ActionAC_TEL=Appel téléphonique ActionAC_TEL=Appel téléphonique
ActionAC_FAX=Envoi fax ActionAC_FAX=Envoi fax
ActionAC_PROP=Envoi proposition par mail ActionAC_PROP=Envoi proposition par mail