Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
85d9d3587e
@ -1004,8 +1004,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Total")."</td>";
|
||||
print '<td align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmount"), 1).'</td>';
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print '<td align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmount"), 1).'</td>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) print '<td align="right">'.$total_task.'</td>';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
@ -171,6 +171,7 @@ ErrorGlobalVariableUpdater5=No global variable selected
|
||||
ErrorFieldMustBeANumeric=Field <b>%s</b> must be a numeric value
|
||||
ErrorFieldMustBeAnInteger=Field <b>%s</b> must be an integer
|
||||
ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided
|
||||
ErrorOppStatusRequiredIfAmount=Vous avez renseigné un montant estimé de l'opportunité. Dans ce cas, il faut aussi renseigner le statut d'opportunité
|
||||
|
||||
# Warnings
|
||||
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
||||
|
||||
@ -127,7 +127,9 @@ TaskCreatedInDolibarr=Task %s created
|
||||
TaskModifiedInDolibarr=Task %s modified
|
||||
TaskDeletedInDolibarr=Task %s deleted
|
||||
OpportunityStatus=Opportunity status
|
||||
OpportunityStatusShort=Opp. status
|
||||
OpportunityAmount=Opportunity amount
|
||||
OpportunityAmountShort=Opp. amount
|
||||
##### Types de contacts #####
|
||||
TypeContact_project_internal_PROJECTLEADER=Project leader
|
||||
TypeContact_project_external_PROJECTLEADER=Project leader
|
||||
|
||||
@ -238,6 +238,12 @@ if (empty($reshook))
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
if ($object->opp_amount && ($object->opp_status <= 0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorOppStatusRequiredIfAmount"),'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->update($user);
|
||||
@ -658,7 +664,7 @@ else
|
||||
|
||||
// Opportunity amount
|
||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
||||
print '<td><input size="4" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount):'')).'"></td>';
|
||||
print '<td><input size="6" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount):'')).'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -899,7 +905,6 @@ else
|
||||
// Hook to add more things on page
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('mainCardTabAddMore',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -19,6 +19,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage statistics on projects
|
||||
*/
|
||||
class ProjectStats extends Stats
|
||||
{
|
||||
protected $db;
|
||||
@ -26,13 +29,14 @@ class ProjectStats extends Stats
|
||||
public $userid;
|
||||
public $socid;
|
||||
public $year;
|
||||
function __construct($db) {
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
require_once 'project.class.php';
|
||||
|
||||
$this->project = new Project($this->db);
|
||||
}
|
||||
|
||||
@ -113,11 +117,15 @@ class ProjectStats extends Stats
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Build the where part
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function buildWhere() {
|
||||
public function buildWhere()
|
||||
{
|
||||
$sqlwhere_str = '';
|
||||
$sqlwhere = array();
|
||||
|
||||
@ -148,7 +156,8 @@ class ProjectStats extends Stats
|
||||
* @param int $year scan
|
||||
* @return array of values
|
||||
*/
|
||||
function getNbByMonth($year) {
|
||||
function getNbByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
@ -174,7 +183,8 @@ class ProjectStats extends Stats
|
||||
* @param int $year scan
|
||||
* @return array with amount by month
|
||||
*/
|
||||
function getAmountByMonth($year) {
|
||||
function getAmountByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
@ -289,18 +299,19 @@ class ProjectStats extends Stats
|
||||
|
||||
|
||||
/**
|
||||
* Return the Project amount by month for a year
|
||||
* Return the Project weighted opp amount by month for a year
|
||||
*
|
||||
* @param int $year scan
|
||||
* @return array with amount by month
|
||||
*/
|
||||
function getWeightedAmountByMonth($year) {
|
||||
function getWeightedAmountByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
|
||||
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount)";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount * ".$this->db->ifsql('cls.percent IS NULL', '0', 'cls.percent')." / 100)";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX.'c_lead_status as cls ON t.fk_opp_status = cls.rowid';
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||
$sql .= $this->buildWhere();
|
||||
@ -401,7 +412,8 @@ class ProjectStats extends Stats
|
||||
* @param int $year scan
|
||||
* @return array with amount by month
|
||||
*/
|
||||
function getTransformRateByMonth($year) {
|
||||
function getTransformRateByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->yearmonth = $year;
|
||||
|
||||
@ -274,13 +274,17 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($conf->global->PROJECT_LIST_SHOW_STARTDATE)) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("OpportunityAmountShort"),$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OpportunityStatusShort"),$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'',$sortfield,$sortorder);
|
||||
}
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print_liste_field_titre($langs->trans("OpportunityStatus"),$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@ -298,7 +302,7 @@ if ($resql)
|
||||
// Sale representative
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Start date
|
||||
if (! empty($conf->global->PROJECT_LIST_SHOW_STARTDATE))
|
||||
if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="sday" value="'.$sday.'">';
|
||||
@ -325,6 +329,8 @@ if ($resql)
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print '<td class="liste_titre nowrap">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre nowrap">';
|
||||
print $formproject->selectOpportunityStatus('search_opp_status',$search_opp_status,1,1);
|
||||
print '</td>';
|
||||
}
|
||||
@ -417,10 +423,13 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// Date start
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($objp->date_start),'day');
|
||||
print '</td>';
|
||||
|
||||
if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($objp->date_start),'day');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Date end
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($objp->date_end),'day');
|
||||
@ -438,6 +447,10 @@ if ($resql)
|
||||
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
print '<td>';
|
||||
if ($objp->opp_status_code) print $langs->trans("OppAmount".$objp->opp_amount);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
if ($objp->opp_status_code) print $langs->trans("OppStatusShort".$objp->opp_status_code);
|
||||
print '</td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Lead
|
||||
* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||
/* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Laurent Destailleur <ldestailleur@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user