FIX Bad value used for task warning delay

FIX Compatibility datee and date_end for warning of tasks
This commit is contained in:
Laurent Destailleur 2016-06-15 13:37:50 +02:00
parent 6711b7fbd1
commit 5b5b7a2bf9
12 changed files with 37 additions and 21 deletions

View File

@ -41,6 +41,10 @@ $modules=array(
)
),
'projet' => array(
array(
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
'img' => 'project'
),
array(
'code' => 'MAIN_DELAY_TASKS_TODO',
'img' => 'task'

View File

@ -508,7 +508,7 @@ class Conf
{
$this->projet->warning_delay=(isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE)?$this->global->MAIN_DELAY_PROJECT_TO_CLOSE:7)*24*60*60;
$this->projet->task = new StdClass();
$this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
$this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_TASKS_TODO:7)*24*60*60;
}
if (isset($this->commande)) {

View File

@ -254,7 +254,7 @@ class Form
* @param string $value Value to show/edit
* @param string $htmlname DIV ID (field name)
* @param int $condition Condition to edit
* @param string $inputType Type of input ('numeric', 'datepicker', 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx')
* @param string $inputType Type of input ('string', 'numeric', 'datepicker', 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx')
* @param string $editvalue When in edit mode, use this value as $value instead of value
* @param object $extObject External object
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
@ -299,6 +299,7 @@ class Form
$inputType=$tmp[0];
if (! empty($tmp[1])) $inputOption=$tmp[1];
if (! empty($tmp[2])) $savemethod=$tmp[2];
$out.= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
}
else if ((preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType)))
{
@ -363,7 +364,6 @@ class Form
$out.= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
$out.= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
}
$out.= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
$out.= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(! empty($editvalue) ? $editvalue : $value).'</span>'."\n";
}

View File

@ -127,7 +127,7 @@ $(document).ready(function() {
$('.editval_string').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 300,
width : withInPlace, /* Size of string area in px ? */
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,

View File

@ -124,13 +124,18 @@ class modProjet extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
/* not required (0 = not present)
$this->const[$r][0] = "PROJECT_HIDE_TASKS";
$this->const[$r][0] = "MAIN_DELAY_PROJECT_TO_CLOSE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "0";
$this->const[$r][2] = "7";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
*/
$r++;
$this->const[$r][0] = "MAIN_DELAY_TASKS_TODO";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "7";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
// Boxes
$this->boxes = array();

View File

@ -979,8 +979,9 @@ DelayBeforeWarning=Delay before warning
DelaysBeforeWarning=Delays before warning
DelaysOfToleranceBeforeWarning=Tolerance delays before warning
DelaysOfToleranceDesc=This screen allows you to define the tolerated delays before an alert is reported on screen with picto %s for each late element.
Delays_MAIN_DELAY_ACTIONS_TODO=Delay tolerance (in days) before alert on planned events not completed yet
Delays_MAIN_DELAY_TASKS_TODO=Delay tolerance (in days) before alert on planned tasks not completed yet
Delays_MAIN_DELAY_ACTIONS_TODO=Delay tolerance (in days) before alert on planned events (agenda events) not completed yet
Delays_MAIN_DELAY_PROJECT_TO_CLOSE=Delay tolerance (in days) before alert on project not closed in time
Delays_MAIN_DELAY_TASKS_TODO=Delay tolerance (in days) before alert on planned tasks (project tasks) not completed yet
Delays_MAIN_DELAY_ORDERS_TO_PROCESS=Delay tolerance (in days) before alert on orders not processed yet
Delays_MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS=Delay tolerance (in days) before alert on suppliers orders not processed yet
Delays_MAIN_DELAY_PROPALS_TO_CLOSE=Delay tolerance (in days) before alert on proposals to close

View File

@ -1179,17 +1179,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
// jQuery jeditable
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
{
print '<!-- JS to manage editInPlace feature -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript">'."\n";
print 'var urlSaveInPlace = \''.DOL_URL_ROOT.'/core/ajax/saveinplace.php\';'."\n";
print 'var urlLoadInPlace = \''.DOL_URL_ROOT.'/core/ajax/loadinplace.php\';'."\n";
print 'var tooltipInPlace = \''.$langs->transnoentities('ClickToEdit').'\';'."\n";
print 'var placeholderInPlace = \''.$langs->trans('ClickToEdit').'\';'."\n";
print 'var tooltipInPlace = \''.$langs->transnoentities('ClickToEdit').'\';'."\n"; // Added in title attribute of span
print 'var placeholderInPlace = \'&nbsp;\';'."\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ?
print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n";
print 'var submitInPlace = \''.$langs->trans('Ok').'\';'."\n";
print 'var indicatorInPlace = \'<img src="'.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
print 'var withInPlace = 300;'; // width in pixel for default string edit
print '</script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/editinplace.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext?'?'.$ext:'').'"></script>'."\n";

View File

@ -485,14 +485,14 @@ if ($id > 0 || $ref)
}
// Stock alert threshold
print '<tr><td>'.$form->editfieldkey("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).'</td><td colspan="2">';
print $form->editfieldval("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer);
print '<tr><td>'.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).'</td><td colspan="2">';
print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string');
print '</td></tr>';
// Desired stock
print '<tr><td>'.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer);
print '</td><td colspan="2">';
print $form->editfieldval("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer);
print $form->editfieldval("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer,'string');
print '</td></tr>';
// Real stock

View File

@ -1711,7 +1711,7 @@ class Project extends CommonObject
/**
* Is the action delayed?
* Is the project delayed?
*
* @return bool
*/

View File

@ -1599,7 +1599,7 @@ class Task extends CommonObject
$task_static->projectstatus = $obj->projectstatus;
$task_static->progress = $obj->progress;
$task_static->fk_statut = $obj->status;
$task_static->datee = $this->db->jdate($obj->datee);
$task_static->date_end = $this->db->jdate($obj->datee);
if ($task_static->hasDelay()) {
$response->nbtodolate++;
@ -1616,7 +1616,7 @@ class Task extends CommonObject
}
/**
* Is the action delayed?
* Is the task delayed?
*
* @return bool
*/
@ -1630,6 +1630,8 @@ class Task extends CommonObject
$now = dol_now();
return ($this->datee > 0 && $this->datee < ($now - $conf->projet->task->warning_delay));
$datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0);
return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay)));
}
}

View File

@ -551,14 +551,15 @@ if ($resql)
$projectstatic->title = $obj->projecttitle;
$projectstatic->public = $obj->public;
$projectstatic->statut = $obj->projectstatus;
$projectstatic->datee = $obj->projectdatee;
$projectstatic->datee = $db->jdate($obj->projectdatee);
$taskstatic->id = $obj->id;
$taskstatic->ref = $obj->ref;
$taskstatic->label = $obj->label;
$taskstatic->fk_statut = $obj->fk_statut;
$taskstatic->progress = $obj->progress;
$taskstatic->datee = $obj->date_end;
$taskstatic->datee = $db->jdate($obj->date_end); // deprecated
$taskstatic->date_end = $db->jdate($obj->date_end);
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0)

View File

@ -437,6 +437,7 @@ if ($id > 0 || ! empty($ref))
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
print dol_print_date($object->date_end,'dayhour');
if ($object->hasDelay()) print img_warning("Late");
print '</td></tr>';
// Planned workload