From 0ac43211ad66e4ff34bcff6ca44a8ae65f1c02b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jul 2015 02:08:06 +0200 Subject: [PATCH] NEW: Add help tooltips on fields of dictionary edit pages. Fix: visible list of tasks are for opened project only. --- htdocs/admin/dict.php | 63 +++++++++++---------- htdocs/core/class/html.formprojet.class.php | 15 +++-- htdocs/imports/import.php | 8 ++- htdocs/langs/en_US/admin.lang | 12 ++++ htdocs/langs/en_US/exports.lang | 1 + htdocs/langs/en_US/projects.lang | 3 +- htdocs/projet/activity/perday.php | 38 +++++++++++-- htdocs/projet/activity/perweek.php | 8 ++- 8 files changed, 103 insertions(+), 45 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3b6fca62005..5ab768e5004 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -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"); } diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 3178fd67620..1e7d455d7b4 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -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) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c46854ec5c1..9c48c680c3f 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -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'])).'
'; } } + // Source required $htmltext.=$langs->trans("SourceRequired").': '.yn(preg_match('/\*$/',$label)).'
'; $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").': '.$example.'
'; @@ -898,6 +899,11 @@ if ($step == 4 && $datatoimport) if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromref') $htmltext.=$langs->trans("SourceExample").': '.$langs->transnoentitiesnoconv("ExampleAnyRefFoundIntoElement",$entitylang).($example?' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')':'').'
'; if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromcodeid') $htmltext.=$langs->trans("SourceExample").': '.$langs->trans("ExampleAnyCodeOrIdFoundIntoDictionary",$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).($example?' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')':'').'
'; } + // Format control rule + if (! empty($objimport->array_import_regex[0][$code])) + { + $htmltext.=$langs->trans("FormatControlRule").': '.$objimport->array_import_regex[0][$code].'
'; + } $htmltext.='
'; // Target field info $htmltext.=''.$langs->trans("FieldTarget").'
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 74c705cf547..d2e001b2383 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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). + + + \ No newline at end of file diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index d396746ccad..6c68d6f677e 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -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 diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index de6f0fe0576..5d560ed4a24 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -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 \ No newline at end of file +ProjectsStatistics=Statistics on projects/leads +TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible. diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index ee50358bdc5..e018bc47446 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -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 '
'; print ''; print ''; +$tmp = dol_getdate($daytoparse); +print ''; +print ''; +print ''; $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperday', '', 0, 'task'); @@ -351,7 +377,7 @@ print ''; print ''; print ''; print $langs->trans("AssignTaskToMe").'
'; -$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 ''; print '
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 85874af86b9..6ffc38cfbe9 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -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 ''; print ''; print ''; print $langs->trans("AssignTaskToMe").'
'; -$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 ''; print '';