NEW: Add help tooltips on fields of dictionary edit pages.

Fix: visible list of tasks are for opened project only.
This commit is contained in:
Laurent Destailleur 2015-07-04 02:08:06 +02:00
parent f320310304
commit 0ac43211ad
8 changed files with 103 additions and 45 deletions

View File

@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("errors");
$langs->load("admin");
$langs->load("companies");
$langs->load("resource");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
@ -364,35 +365,35 @@ $tabcond[29]= ! empty($conf->projet->enabled);
// List of help for fields
$tabhelp=array();
$tabhelp[1] = array();
$tabhelp[2] = array();
$tabhelp[3] = array();
$tabhelp[4] = array();
$tabhelp[5] = array();
$tabhelp[6] = array();
$tabhelp[7] = array();
$tabhelp[8] = array();
$tabhelp[9] = array();
$tabhelp[10] = array();
$tabhelp[1] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[2] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[3] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[4] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[5] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[6] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[7] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"));
$tabhelp[10] = array('taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"));
$tabhelp[11] = array();
$tabhelp[12] = array();
$tabhelp[13] = array();
$tabhelp[14] = array();
$tabhelp[15] = array();
$tabhelp[16] = array();
$tabhelp[17] = array();
$tabhelp[18] = array();
$tabhelp[19] = array();
$tabhelp[20] = array();
$tabhelp[21] = array();
$tabhelp[22] = array();
$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[14] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[15] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[16] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[17] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[18] = array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"));
$tabhelp[19] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[20] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array();
$tabhelp[24] = array();
$tabhelp[25] = array();
$tabhelp[26] = array();
$tabhelp[27] = array();
$tabhelp[28] = array();
$tabhelp[29] = array();
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('type_template'=>$langs->trans("TemplateFor"),'private'=>$langs->trans("TemplateIsVisibleByYouOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@ -869,9 +870,9 @@ if ($id)
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";}
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";}
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
@ -1013,9 +1014,9 @@ if ($id)
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }

View File

@ -261,7 +261,7 @@ class FormProjets
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id task preselected
* @param string $htmlname Nom de la zone html
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
@ -270,7 +270,7 @@ class FormProjets
* @param int $disabled Disabled
* @return int Nber of project if OK, <0 if KO
*/
function select_task($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0)
function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0)
{
global $user,$conf,$langs;
@ -289,8 +289,11 @@ class FormProjets
}
// Search all projects
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.ref, p.title, p.fk_soc, p.fk_statut, p.public';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p, '.MAIN_DB_PREFIX.'projet_task as t';
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,';
$sql.= ' s.nom as name';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc';
$sql.= ', '.MAIN_DB_PREFIX.'projet_task as t';
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND t.fk_projet = p.rowid";
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
@ -312,7 +315,7 @@ class FormProjets
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
$minmax='minwidth100';
$minmax='minwidth200';
}
if (empty($option_only)) {
@ -346,6 +349,8 @@ class FormProjets
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
if ($obj->name) $labeltoshow.=' ('.$obj->name.')';
$disabled=0;
if ($obj->fk_statut == 0)
{

View File

@ -886,9 +886,10 @@ if ($step == 4 && $datatoimport)
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromcodeid') $htmltext.=$langs->trans("DataComeFromIdFoundFromCodeId",$filecolumn,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).'<br>';
}
}
// Source required
$htmltext.=$langs->trans("SourceRequired").': <b>'.yn(preg_match('/\*$/',$label)).'</b><br>';
$example=$objimport->array_import_examplevalues[0][$code];
// Example
if (empty($objimport->array_import_convertvalue[0][$code])) // If source file does not need convertion
{
if ($example) $htmltext.=$langs->trans("SourceExample").': <b>'.$example.'</b><br>';
@ -898,6 +899,11 @@ if ($step == 4 && $datatoimport)
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromref') $htmltext.=$langs->trans("SourceExample").': <b>'.$langs->transnoentitiesnoconv("ExampleAnyRefFoundIntoElement",$entitylang).($example?' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')':'').'</b><br>';
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromcodeid') $htmltext.=$langs->trans("SourceExample").': <b>'.$langs->trans("ExampleAnyCodeOrIdFoundIntoDictionary",$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).($example?' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')':'').'</b><br>';
}
// Format control rule
if (! empty($objimport->array_import_regex[0][$code]))
{
$htmltext.=$langs->trans("FormatControlRule").': <b>'.$objimport->array_import_regex[0][$code].'</b><br>';
}
$htmltext.='<br>';
// Target field info
$htmltext.='<b><u>'.$langs->trans("FieldTarget").'</u></b><br>';

View File

@ -1651,3 +1651,15 @@ LeftMenuBackgroundColor=Background color for Left menu
BackgroundTableTitleColor=Background color for table title line
BackgroundTableLineOddColor=Background color for odd table lines
BackgroundTableLineEvenColor=Background color for even table lines
MinimumNoticePeriod=Minimum notice period (Your leave request must be done before this delay)
NbAddedAutomatically=Number of days added to counters of users (automatically) each month
EnterAnyCode=This field contains a reference to identify line. Enter any value of your choice, but without special characters.
UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For exemple: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364]
PositionIntoComboList=Position of line into combo lists
SellTaxRate=Sale tax rate
RecuperableOnly=Yes for VAT "Non Perçue Récupérable" dedicated for some state in France. Keep value to "No" in all other cases.
UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipment, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card.
OpportunityPercent=When you create an opportunity, you will defined an estimated amount of project/lead. According to status of opportunity, this amount may be multiplicated by this rate to evaluate global amount all your opportunities may generate. Value is percent (between 0 and 100).

View File

@ -132,3 +132,4 @@ SelectFilterFields=If you want to filter on some values, just input values here.
FilterableFields=Champs Filtrables
FilteredFields=Filtered fields
FilteredFieldsValues=Value for filter
FormatControlRule=Format control rule

View File

@ -159,4 +159,5 @@ ProjectOverview=Overview
ManageTasks=Use projects to follow tasks and time
ManageOpportunitiesStatus=Use projects to follow leads/opportinuties
ProjectNbProjectByMonth=Nb of created projects by month
ProjectsStatistics=Statistics on projects/leads
ProjectsStatistics=Statistics on projects/leads
TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible.

View File

@ -63,8 +63,14 @@ $day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"
$day = (int) $day;
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$monthofday=GETPOST('addtimemonth');
$dayofday=GETPOST('addtimeday');
$yearofday=GETPOST('addtimeyear');
$daytoparse = $now;
if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year);
if ($yearofday && $monthofday && $dayofday) $daytoparse=dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
$object=new Task($db);
@ -106,6 +112,7 @@ if ($action == 'assign')
if ($result < 0)
{
$error++;
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
@ -117,6 +124,11 @@ if ($action == 'assign')
}
}
if (! $error)
{
setEventMessages($langs->trans("TaskAssignedToEnterTime"), null);
}
$action='';
}
@ -154,15 +166,25 @@ if ($action == 'addtime' && $user->rights->projet->creer)
$object->timespent_fk_user = $user->id;
if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered
{
$object->timespent_date = dol_mktime(GETPOST($key."hour"),GETPOST($key."min"),0,GETPOST($key."month"),GETPOST($key."day"),GETPOST($key."year"));
$object->timespent_date = dol_mktime(GETPOST($key."hour"),GETPOST($key."min"),0,$monthofday,$dayofday,$yearofday);
$object->timespent_withhour = 1;
}
else
{
$object->timespent_date = dol_mktime(12,0,0,GETPOST($key."month"),GETPOST($key."day"),GETPOST($key."year"));
$object->timespent_date = dol_mktime(12,0,0,$monthofday,$dayofday,$yearofday);
}
if ($object->timespent_date > 0)
{
$result=$object->addTimeSpent($user);
}
else
{
setEventMessages($langs->trans("ErrorBadDate"), null, 'errors');
$error++;
break;
}
$result=$object->addTimeSpent($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -176,7 +198,7 @@ if ($action == 'addtime' && $user->rights->projet->creer)
setEventMessage($langs->trans("RecordSaved"));
// Redirect to avoid submit twice on back
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:''));
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
exit;
}
}
@ -252,6 +274,10 @@ print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].($proje
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addtime">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$tmp = dol_getdate($daytoparse);
print '<input type="hidden" name="addtimeyear" value="'.$tmp['year'].'">';
print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
$head=project_timesheet_prepare_head($mode);
dol_fiche_head($head, 'inputperday', '', 0, 'task');
@ -351,7 +377,7 @@ print '<input type="hidden" name="year" value="'.$year.'">';
print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="day" value="'.$day.'">';
print $langs->trans("AssignTaskToMe").'<br>';
$formproject->select_task($socid?$socid:-1, $taskid, 'taskid');
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 1);
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AssignTask").'">';
print '</form>';

View File

@ -124,6 +124,7 @@ if ($action == 'assign')
if ($result < 0)
{
$error++;
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
@ -135,6 +136,11 @@ if ($action == 'assign')
}
}
if (! $error)
{
setEventMessages($langs->trans("TaskAssignedToEnterTime"), null);
}
$action='';
}
@ -376,7 +382,7 @@ print '<input type="hidden" name="year" value="'.$year.'">';
print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="day" value="'.$day.'">';
print $langs->trans("AssignTaskToMe").'<br>';
$formproject->select_task($socid?$socid:-1, $taskid, 'taskid');
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 1);
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AssignTask").'">';
print '</form>';