Skip to content

Commit

Permalink
FIX Bad value used for task warning delay
Browse files Browse the repository at this point in the history
FIX Compatibility datee and date_end for warning of tasks
  • Loading branch information
eldy committed Jun 15, 2016
1 parent 6711b7f commit 5b5b7a2
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 21 deletions.
4 changes: 4 additions & 0 deletions htdocs/admin/delais.php
Expand Up @@ -41,6 +41,10 @@
)
),
'projet' => array(
array(
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
'img' => 'project'
),
array(
'code' => 'MAIN_DELAY_TASKS_TODO',
'img' => 'task'
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/conf.class.php
Expand Up @@ -508,7 +508,7 @@ function setValues($db)
{
$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)) {
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -254,7 +254,7 @@ function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='str
* @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')
Expand Down Expand Up @@ -299,6 +299,7 @@ private function editInPlace($object, $value, $htmlname, $condition, $inputType=
$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)))
{
Expand Down Expand Up @@ -363,7 +364,6 @@ private function editInPlace($object, $value, $htmlname, $condition, $inputType=
$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";
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/js/editinplace.js
Expand Up @@ -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,
Expand Down
13 changes: 9 additions & 4 deletions htdocs/core/modules/modProjet.class.php
Expand Up @@ -124,13 +124,18 @@ function __construct($db)
$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();
Expand Down
5 changes: 3 additions & 2 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions htdocs/main.inc.php
Expand Up @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions htdocs/product/stock/product.php
Expand Up @@ -485,14 +485,14 @@
}

// 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
Expand Down
2 changes: 1 addition & 1 deletion htdocs/projet/class/project.class.php
Expand Up @@ -1711,7 +1711,7 @@ function load_state_board()


/**
* Is the action delayed?
* Is the project delayed?
*
* @return bool
*/
Expand Down
8 changes: 5 additions & 3 deletions htdocs/projet/class/task.class.php
Expand Up @@ -1599,7 +1599,7 @@ function load_board($user)
$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++;
Expand All @@ -1616,7 +1616,7 @@ function load_board($user)
}

/**
* Is the action delayed?
* Is the task delayed?
*
* @return bool
*/
Expand All @@ -1630,6 +1630,8 @@ public function hasDelay()

$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)));
}
}
5 changes: 3 additions & 2 deletions htdocs/projet/tasks/list.php
Expand Up @@ -551,14 +551,15 @@
$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)
Expand Down
1 change: 1 addition & 0 deletions htdocs/projet/tasks/task.php
Expand Up @@ -437,6 +437,7 @@
// 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
Expand Down

0 comments on commit 5b5b7a2

Please sign in to comment.