Merge branch 'master' into dist/eole/2.7.2/master
This commit is contained in:
@@ -399,6 +399,10 @@ app_timer_delete:
|
|||||||
|
|
||||||
|
|
||||||
#== Customer ======================================================================================================
|
#== Customer ======================================================================================================
|
||||||
|
app_customer_home:
|
||||||
|
path: /customer
|
||||||
|
defaults: { _controller: App\Controller\HomeController:customer }
|
||||||
|
|
||||||
app_customer_report:
|
app_customer_report:
|
||||||
path: /customer/report/{key}
|
path: /customer/report/{key}
|
||||||
defaults: { _controller: App\Controller\ReportController:report, access: 'customer' }
|
defaults: { _controller: App\Controller\ReportController:report, access: 'customer' }
|
||||||
@@ -428,6 +432,10 @@ export_offers:
|
|||||||
path: /export/export_offers
|
path: /export/export_offers
|
||||||
defaults: { _controller: App\Controller\ExportController:export_offers }
|
defaults: { _controller: App\Controller\ExportController:export_offers }
|
||||||
|
|
||||||
|
export_month_charged_days:
|
||||||
|
path: /export/export_month_charged_days
|
||||||
|
defaults: { _controller: App\Controller\ExportController:export_month_charged_days }
|
||||||
|
|
||||||
|
|
||||||
#== Export ======================================================================================================
|
#== Export ======================================================================================================
|
||||||
app_stat_view:
|
app_stat_view:
|
||||||
|
@@ -174,10 +174,10 @@ while($row=$queryold->fetch()) {
|
|||||||
$nature=$row["task_nature"];
|
$nature=$row["task_nature"];
|
||||||
if($row["task_id"]<=-70) $nature=-200;
|
if($row["task_id"]<=-70) $nature=-200;
|
||||||
if($row["task_id"]==-85 || $row["task_id"]==-70) $nature=-190;
|
if($row["task_id"]==-85 || $row["task_id"]==-70) $nature=-190;
|
||||||
$q="INSERT IGNORE INTO task (id, name, color, quantity, validate, project_id, nature_id ) VALUES (?,?,?,?,?,?,?)";
|
$q="INSERT IGNORE INTO task (id, name, color, quantity, validate, project_id, nature_id, active) VALUES (?,?,?,?,?,?,?,?)";
|
||||||
$quantity=($row["task_quantity"]==0?null:$row["task_quantity"]);
|
$quantity=($row["task_quantity"]==0?null:$row["task_quantity"]);
|
||||||
$query=$bddnew->prepare($q);
|
$query=$bddnew->prepare($q);
|
||||||
$query->execute([$row["task_id"],$row["task_name"],"#".$row["task_color"],$quantity,$row["task_validate"],$row["task_project"],$nature ]);
|
$query->execute([$row["task_id"],$row["task_name"],"#".$row["task_color"],$quantity,$row["task_validate"],$row["task_project"],$nature, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeligne("");
|
writeligne("");
|
||||||
|
@@ -473,5 +473,58 @@ class ExportController extends AbstractController
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function export_month_charged_days(Request $request,$access=null): Response {
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$nbmonth=$this->get("session")->get("nbmonth");
|
||||||
|
|
||||||
|
$tbevents=[];
|
||||||
|
// On formate le tableau des event
|
||||||
|
$start=new \Datetime('first day of this month');
|
||||||
|
$start->sub(new \DateInterval('P'.$nbmonth.'M'));
|
||||||
|
$start->setTime(0,0,0);
|
||||||
|
$end = new \Datetime('first day of this month');
|
||||||
|
$end->add(new \DateInterval('P1M'));
|
||||||
|
$end->setTime(23,59,0);
|
||||||
|
|
||||||
|
$events = $em
|
||||||
|
->createQueryBuilder('event')
|
||||||
|
->select('event')
|
||||||
|
->from('App:Event','event')
|
||||||
|
->Where('event.start>=:start AND event.end <:end')
|
||||||
|
->setParameter('start',$start)
|
||||||
|
->setParameter('end',$end)
|
||||||
|
->getQuery()->getResult();
|
||||||
|
|
||||||
|
foreach($events as $event) {
|
||||||
|
if (!isset($tbevents[$event->getStart()->format("m")])) {
|
||||||
|
$tbevents[$event->getStart()->format("m")]["f"]=0;
|
||||||
|
$tbevents[$event->getStart()->format("m")]["nf"]=0;
|
||||||
|
}
|
||||||
|
if ($event->getTask()->getNature()->getName() == "Prestation") {
|
||||||
|
if (!isset($tbevents[$event->getStart()->format("m")])){
|
||||||
|
|
||||||
|
$tbevents[$event->getStart()->format("m")]['f'] = $event->getDuration();
|
||||||
|
}else{
|
||||||
|
$tbevents[$event->getStart()->format("m")]['f'] += $event->getDuration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($event->getTask()->getNature()->getName() != "Prestation") {
|
||||||
|
if (!isset($tbevents[$event->getStart()->format("m")])){
|
||||||
|
$tbevents[$event->getStart()->format("m")]['nf'] = $event->getDuration();
|
||||||
|
}else{
|
||||||
|
$tbevents[$event->getStart()->format("m")]['nf'] += $event->getDuration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$csv = $this->renderView('Export/export_month_charged_days.csv.twig', ["events" => $tbevents]);
|
||||||
|
$response = new Response($csv);
|
||||||
|
$response->headers->set('Content-Type', 'text/csv; charset=utf-8');
|
||||||
|
$response->headers->set('Content-Disposition', 'attachment; filename="export_month_charged_days.csv"');
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,14 @@ class HomeController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function customer()
|
||||||
|
{
|
||||||
|
return $this->render('Home/customer.html.twig',[
|
||||||
|
"useheader" => true,
|
||||||
|
"usesidebar" => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function selectmonth(Request $request)
|
public function selectmonth(Request $request)
|
||||||
{
|
{
|
||||||
$nbmonth = $request->request->get('nbmonth');
|
$nbmonth = $request->request->get('nbmonth');
|
||||||
|
@@ -97,7 +97,7 @@ class SecurityController extends AbstractController
|
|||||||
$user->setPassword("CASPWD-".$username);
|
$user->setPassword("CASPWD-".$username);
|
||||||
$user->setSalt("CASPWD-".$username);
|
$user->setSalt("CASPWD-".$username);
|
||||||
|
|
||||||
$user->setRole("ROLE_USER");
|
$user->setRoles(["ROLE_VISITOR"]);
|
||||||
|
|
||||||
$em->persist($user);
|
$em->persist($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
@@ -125,8 +125,15 @@ class SecurityController extends AbstractController
|
|||||||
// Redirection
|
// Redirection
|
||||||
if($redirect)
|
if($redirect)
|
||||||
return $this->redirect($redirect);
|
return $this->redirect($redirect);
|
||||||
else
|
else {
|
||||||
return $this->redirect($this->generateUrl('app_home'));
|
$roles=$user->getRoles();
|
||||||
|
if(!in_array("ROLE_VISITOR",$roles))
|
||||||
|
return $this->redirect($this->generateUrl('app_home'));
|
||||||
|
else {
|
||||||
|
dump("here");
|
||||||
|
return $this->redirect($this->generateUrl('app_customer_home'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -55,6 +55,7 @@ class TaskController extends AbstractController
|
|||||||
$data = new Entity();
|
$data = new Entity();
|
||||||
$defaultnature = $em->getRepository("App:Nature")->findOneBy(['name' => 'Prestation']);
|
$defaultnature = $em->getRepository("App:Nature")->findOneBy(['name' => 'Prestation']);
|
||||||
$data->setNature($defaultnature);
|
$data->setNature($defaultnature);
|
||||||
|
$data->setActive(true);
|
||||||
// Création du formulaire
|
// Création du formulaire
|
||||||
$form = $this->createForm(Form::class,$data,array("mode"=>"submit"));
|
$form = $this->createForm(Form::class,$data,array("mode"=>"submit"));
|
||||||
|
|
||||||
|
@@ -70,7 +70,11 @@ class Task
|
|||||||
* @ORM\OneToMany(targetEntity="Penalty", mappedBy="task", cascade={"persist"}, orphanRemoval=false)
|
* @ORM\OneToMany(targetEntity="Penalty", mappedBy="task", cascade={"persist"}, orphanRemoval=false)
|
||||||
*/
|
*/
|
||||||
private $penaltys;
|
private $penaltys;
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="active", type="boolean")
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private $active;
|
||||||
/**
|
/**
|
||||||
* Calculate Displayname
|
* Calculate Displayname
|
||||||
*/
|
*/
|
||||||
@@ -228,6 +232,19 @@ class Task
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getActive(): ?bool
|
||||||
|
{
|
||||||
|
return $this->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
|
$this->active = $active;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection|Penalty[]
|
* @return Collection|Penalty[]
|
||||||
*/
|
*/
|
||||||
|
@@ -57,6 +57,13 @@ class TaskType extends AbstractType
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$builder->add("active",
|
||||||
|
ChoiceType::class,[
|
||||||
|
"label" => "Actif",
|
||||||
|
"choices" => ["Non"=>false, "Oui"=>true]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$builder->add('color',
|
$builder->add('color',
|
||||||
TextType::class, [
|
TextType::class, [
|
||||||
"label" => "Couleur",
|
"label" => "Couleur",
|
||||||
|
@@ -99,7 +99,9 @@
|
|||||||
{% for project in projects|sort((a, b) => a.displayname <=> b.displayname) %}
|
{% for project in projects|sort((a, b) => a.displayname <=> b.displayname) %}
|
||||||
<optgroup label="{{project.displayname}}">
|
<optgroup label="{{project.displayname}}">
|
||||||
{% for task in project.tasks|sort((a, b) => a.displayname <=> b.displayname) %}
|
{% for task in project.tasks|sort((a, b) => a.displayname <=> b.displayname) %}
|
||||||
|
{% if task.active %}
|
||||||
<option value="{{task.id}}">{{task.displayname}}</option>
|
<option value="{{task.id}}">{{task.displayname}}</option>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
{% block body %}
|
||||||
|
Mois;Jours_facturés;Jour_non_facturés
|
||||||
|
{% for month, event in events %}
|
||||||
|
{{month}};{{event.f}};{{event.nf}}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
@@ -43,4 +43,14 @@ EXPORTS DE DONNEES
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p></p>
|
<p></p>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<a class="btn btn-success" href={{ path('export_month_charged_days') }}>Export des jours facturés/non-facturés</a>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p>Exporter la liste du nombre de jours facturés et non-facturés par mois</p>
|
||||||
|
<p>Filtres utiles : Nombre de mois</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p></p>
|
||||||
{% endblock %}
|
{% endblock %}
|
8
src/schedule-2.0/templates/Home/customer.html.twig
Normal file
8
src/schedule-2.0/templates/Home/customer.html.twig
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{% extends "base.html.twig" %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<center>Merci d'utiliser l'URL qui vous a été communiquée pour visualiser votre rapport.</center>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
@@ -54,6 +54,7 @@
|
|||||||
{{ form_row(form.name) }}
|
{{ form_row(form.name) }}
|
||||||
{{ form_row(form.project) }}
|
{{ form_row(form.project) }}
|
||||||
{{ form_row(form.nature) }}
|
{{ form_row(form.nature) }}
|
||||||
|
{{ form_row(form.active) }}
|
||||||
{{ form_row(form.quantity) }}
|
{{ form_row(form.quantity) }}
|
||||||
{{ form_row(form.color) }}
|
{{ form_row(form.color) }}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -63,6 +63,7 @@
|
|||||||
<th width="100px">Nature</th>
|
<th width="100px">Nature</th>
|
||||||
<th width="100px">Projet</th>
|
<th width="100px">Projet</th>
|
||||||
<th>Tâche</th>
|
<th>Tâche</th>
|
||||||
|
<th>Actif</th>
|
||||||
<th width="100px" class="text-center no-string">Estimation</th>
|
<th width="100px" class="text-center no-string">Estimation</th>
|
||||||
<th width="100px" class="text-center no-string">Validé</th>
|
<th width="100px" class="text-center no-string">Validé</th>
|
||||||
<th width="100px" class="text-center no-string">Planifié</th>
|
<th width="100px" class="text-center no-string">Planifié</th>
|
||||||
@@ -99,6 +100,7 @@
|
|||||||
<td>{{task.nature.name}}</td>
|
<td>{{task.nature.name}}</td>
|
||||||
<td>{{task.project.name}}</td>
|
<td>{{task.project.name}}</td>
|
||||||
<td>{{task.name}}</td>
|
<td>{{task.name}}</td>
|
||||||
|
<td>{{task.active ? "actif":"non-actif"}}</td>
|
||||||
<td class="text-right">{{task.quantity|number_format(2, '.', ' ')}}</td>
|
<td class="text-right">{{task.quantity|number_format(2, '.', ' ')}}</td>
|
||||||
<td class="text-right">{{(totvalidate*-1)|number_format(2, '.', ' ')}}</td>
|
<td class="text-right">{{(totvalidate*-1)|number_format(2, '.', ' ')}}</td>
|
||||||
<td class="text-right">{{((totplanified-totvalidate)*-1)|number_format(2, '.', ' ')}}</td>
|
<td class="text-right">{{((totplanified-totvalidate)*-1)|number_format(2, '.', ' ')}}</td>
|
||||||
|
@@ -216,7 +216,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="nav navbar-top-links navbar-right">
|
<ul class="nav navbar-top-links navbar-right">
|
||||||
{% if app.user %}
|
{% if app.user and ("ROLE_USER" in app.user.roles or "ROLE_MASTER" in app.user.roles or "ROLE_VALIDATOR" in app.user.roles or "ROLE_ADMIN" in app.user.roles)%}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{path("app_user_profil")}}">
|
<a href="{{path("app_user_profil")}}">
|
||||||
<img src="\{{appAlias}}\uploads\avatar\{{app.user.avatar}}" class="avatar">
|
<img src="\{{appAlias}}\uploads\avatar\{{app.user.avatar}}" class="avatar">
|
||||||
|
Reference in New Issue
Block a user