Merge pull request #7499 from atm-gauthier/NEW_custom_meteo
New custom meteo
This commit is contained in:
commit
3f3a5e0921
@ -138,6 +138,16 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE",GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
// For update value with percentage
|
||||||
|
$plus='';
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
|
||||||
|
// Update values
|
||||||
|
for($i=0;$i<4;$i++) {
|
||||||
|
if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,13 +206,6 @@ if ($action == 'edit')
|
|||||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -244,21 +247,30 @@ else
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Boutons d'action
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br />';
|
||||||
|
|
||||||
|
|
||||||
// Show logo for weather
|
// Show logo for weather
|
||||||
print $langs->trans("DescWeather").'<br>';
|
print $langs->trans("DescWeather").'<br>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod'));
|
||||||
|
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod'));
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
|
||||||
|
else $str_mode_enabled = $str_mode_percentage;
|
||||||
|
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
|
||||||
|
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
|
||||||
|
|
||||||
|
print '<br /><br />';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
|
||||||
|
else print $langs->trans('MeteoPercentageModEnabled');
|
||||||
|
print '<br /><br />';
|
||||||
|
}
|
||||||
|
|
||||||
$offset=0;
|
$offset=0;
|
||||||
$cursor=10; // By default
|
$cursor=10; // By default
|
||||||
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
||||||
@ -268,6 +280,141 @@ $level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level
|
|||||||
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
||||||
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
||||||
$text=''; $options='height="60px"';
|
$text=''; $options='height="60px"';
|
||||||
|
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
|
||||||
|
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
|
||||||
|
|
||||||
|
print '<table>';
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '</td><td>= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '</td><td><= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '</td><td><= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr><td>';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '</td><td><= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
/*print '<td>';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '</td><td>> '.$level3.'</td>';*/
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
|
||||||
|
|
||||||
|
print '<table>';
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '</td><td>= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '</td><td><= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '</td><td><= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr><td>';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '</td><td><= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
/*print '<td>';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '</td><td>> '.$level3.'</td>';*/
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#change_mode").click(function() {
|
||||||
|
var use_percent = $("#MAIN_USE_METEO_WITH_PERCENTAGE");
|
||||||
|
var str_mode_std = "<?php print $str_mode_std; ?>";
|
||||||
|
var str_mode_percentage = "<?php print $str_mode_percentage; ?>";
|
||||||
|
|
||||||
|
if(use_percent.val() == 1) {
|
||||||
|
use_percent.val(0);
|
||||||
|
$("#standard").show();
|
||||||
|
$("#percentage").hide();
|
||||||
|
$(this).html(str_mode_std);
|
||||||
|
} else {
|
||||||
|
use_percent.val(1);
|
||||||
|
$("#standard").hide();
|
||||||
|
$("#percentage").show();
|
||||||
|
$(this).html(str_mode_percentage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||||
|
|
||||||
|
print '<table>';
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '</td><td>= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '</td><td><= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '</td><td><= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr><td>';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '</td><td><= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '</td><td>> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
print '<table>';
|
print '<table>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -297,6 +444,23 @@ print '</tr>';
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||||
|
print '<br></form>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Boutons d'action
|
||||||
|
print '<br><div class="tabsAction">';
|
||||||
|
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -912,18 +912,24 @@ class ActionComm extends CommonObject
|
|||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
* @param User $user Objet user
|
* @param User $user Objet user
|
||||||
|
* @param int $load_state_board Charge indicateurs this->nb de tableau de bord
|
||||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
*/
|
*/
|
||||||
function load_board($user)
|
function load_board($user, $load_state_board=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$sql = "SELECT a.id, a.datep as dp";
|
if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp";
|
||||||
|
else {
|
||||||
|
$this->nb=array();
|
||||||
|
$sql = "SELECT count(a.id) as nb";
|
||||||
|
}
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||||
$sql.= " WHERE a.percent >= 0 AND a.percent < 100";
|
$sql.= " WHERE 1";
|
||||||
|
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
|
||||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
||||||
@ -932,31 +938,32 @@ class ActionComm extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
if(empty($load_state_board)) {
|
||||||
$agenda_static = new ActionComm($this->db);
|
$agenda_static = new ActionComm($this->db);
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||||
$response->label = $langs->trans("ActionsToDo");
|
$response->label = $langs->trans("ActionsToDo");
|
||||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
||||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||||
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
||||||
|
}
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
|
if(empty($load_state_board)) {
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$agenda_static->datep = $this->db->jdate($obj->dp);
|
$agenda_static->datep = $this->db->jdate($obj->dp);
|
||||||
|
if ($agenda_static->hasDelay()) $response->nbtodolate++;
|
||||||
if ($agenda_static->hasDelay()) {
|
} else $this->nb["actionscomm"]=$obj->nb;
|
||||||
$response->nbtodolate++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
$this->db->free($resql);
|
||||||
|
if(empty($load_state_board)) return $response;
|
||||||
|
else return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1207,6 +1207,44 @@ class Account extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
* @param int $filteraccountid To get info for a particular account id
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board($filteraccountid = 0)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||||
|
$sql.= " AND clos = 0";
|
||||||
|
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["banklines"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
|
|||||||
@ -533,6 +533,45 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql.= " AND b.fk_type = 'CHQ'";
|
||||||
|
$sql.= " AND b.amount > 0";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["cheques"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build document
|
* Build document
|
||||||
*
|
*
|
||||||
|
|||||||
@ -501,7 +501,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_p
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate total nb of late
|
// Calculate total nb of late
|
||||||
$totallate=0;
|
$totallate=$totaltodo=0;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
//Remove any invalid response
|
//Remove any invalid response
|
||||||
@ -516,11 +516,13 @@ foreach($dashboardlines as $tmp)
|
|||||||
foreach($valid_dashboardlines as $board)
|
foreach($valid_dashboardlines as $board)
|
||||||
{
|
{
|
||||||
if ($board->nbtodolate > 0) {
|
if ($board->nbtodolate > 0) {
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totaltodo += $board->nbtodo;
|
||||||
$totallate += $board->nbtodolate;
|
$totallate += $board->nbtodolate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//var_dump($totallate, $totaltodo);
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||||
|
//var_dump($totallate);
|
||||||
$boxwork='';
|
$boxwork='';
|
||||||
$boxwork.='<div class="box">';
|
$boxwork.='<div class="box">';
|
||||||
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
|
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
|
||||||
@ -533,7 +535,7 @@ if ($showweather)
|
|||||||
$boxwork.='<tr class="nohover">';
|
$boxwork.='<tr class="nohover">';
|
||||||
$boxwork.='<td class="nohover hideonsmartphone center valignmiddle">';
|
$boxwork.='<td class="nohover hideonsmartphone center valignmiddle">';
|
||||||
$text='';
|
$text='';
|
||||||
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate).')';
|
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||||
$text.='. '.$langs->trans("LateDesc");
|
$text.='. '.$langs->trans("LateDesc");
|
||||||
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
|
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
|
||||||
$options='height="64px"';
|
$options='height="64px"';
|
||||||
@ -691,10 +693,12 @@ function showWeather($totallate,$text,$options)
|
|||||||
$offset=0;
|
$offset=0;
|
||||||
$factor=10; // By default
|
$factor=10; // By default
|
||||||
|
|
||||||
$level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level0=$conf->global->MAIN_METEO_LEVEL0;
|
$used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
|
||||||
$level1=$offset+1*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
|
||||||
$level2=$offset+2*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
$level0=$offset; if (! empty($conf->global->{$used_conf.'0'})) $level0=$conf->global->{$used_conf.'0'};
|
||||||
$level3=$offset+3*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
$level1=$offset+1*$factor; if (! empty($conf->global->{$used_conf.'1'})) $level1=$conf->global->{$used_conf.'1'};
|
||||||
|
$level2=$offset+2*$factor; if (! empty($conf->global->{$used_conf.'2'})) $level2=$conf->global->{$used_conf.'2'};
|
||||||
|
$level3=$offset+3*$factor; if (! empty($conf->global->{$used_conf.'3'})) $level3=$conf->global->{$used_conf.'3'};
|
||||||
|
|
||||||
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
|
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
|
||||||
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
|
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
|||||||
@ -1089,6 +1089,11 @@ ShowProfIdInAddress=Show professionnal id with addresses on documents
|
|||||||
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
|
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
|
||||||
TranslationUncomplete=Partial translation
|
TranslationUncomplete=Partial translation
|
||||||
MAIN_DISABLE_METEO=Disable meteo view
|
MAIN_DISABLE_METEO=Disable meteo view
|
||||||
|
MeteoStdMod=Standard mode
|
||||||
|
MeteoStdModEnabled=Standard mode enabled
|
||||||
|
MeteoPercentageMod=Percentage mode
|
||||||
|
MeteoPercentageModEnabled=Percentage mode enabled
|
||||||
|
MeteoUseMod=Click to use %s
|
||||||
TestLoginToAPI=Test login to API
|
TestLoginToAPI=Test login to API
|
||||||
ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it.
|
ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it.
|
||||||
ExternalAccess=External access
|
ExternalAccess=External access
|
||||||
|
|||||||
@ -1764,6 +1764,55 @@ class Task extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$mine=0; $socid=$user->societe_id;
|
||||||
|
|
||||||
|
$projectstatic = new Project($this->db);
|
||||||
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||||
|
|
||||||
|
// List of tasks (does not care about permissions. Filtering will be done later)
|
||||||
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
|
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||||
|
$sql.= " AND t.fk_projet = p.rowid"; // tasks to do
|
||||||
|
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||||
|
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||||
|
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
|
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
|
||||||
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["tasks"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the task delayed?
|
* Is the task delayed?
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user