diff --git a/build/docker-compose.yml b/build/docker-compose.yml index 0e3d378d..cae1c9a3 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -9,7 +9,7 @@ services: volumes: - ../htdocs:/var/www/html/custom:rw ports: - - 801:80 + - 8080:80 env_file: .env links: diff --git a/htdocs/timesheet/TimesheetProjectInvoice.php b/htdocs/timesheet/TimesheetProjectInvoice.php index d063ae73..d13924fc 100644 --- a/htdocs/timesheet/TimesheetProjectInvoice.php +++ b/htdocs/timesheet/TimesheetProjectInvoice.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; //get param $staticProject = new Project($db); $projectId = GETPOST('projectid', 'int'); @@ -276,23 +277,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $htmlother = new FormOther($db); $sqlTail = ''; - if(!$user->admin) { - $sqlTailJoin = ' JOIN '.MAIN_DB_PREFIX.'element_contact AS ec ON t.rowid = element_id '; - $sqlTailJoin .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact as ctc ON ctc.rowid = ec.fk_c_type_contact'; - $sqlTailWhere = ' ((ctc.element in (\'project_task\') AND ctc.code LIKE \'%EXECUTIVE%\')OR (ctc.element in (\'project\') AND ctc.code LIKE \'%LEADER%\')) AND ctc.active = \'1\' '; - $sqlTailWhere .= ' AND fk_socpeople = \''.$userid.'\' and t.fk_statut = \'1\''; - } + //if(!$user->admin) { + // $sqlTailJoin = ' JOIN '.MAIN_DB_PREFIX.'element_contact AS ec ON t.rowid = element_id '; + // $sqlTailJoin .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact as ctc ON ctc.rowid = ec.fk_c_type_contact'; + // $sqlTailWhere = ' ((ctc.element in (\'project_task\') AND ctc.code LIKE \'%EXECUTIVE%\')OR (ctc.element in (\'project\') AND ctc.code LIKE \'%LEADER%\')) AND ctc.active = \'1\' '; + // $sqlTailWhere .= ' AND fk_socpeople = \''.$userid.'\' and t.fk_statut = \'1\''; + //} $Form = '
'."\n\t"; $Form .= ''."\n\t\t"; $Form .= ''; $invoicingMethod = $conf->global->TIMESHEET_INVOICE_METHOD; - $Form .= ''; $Form .= '"; $Form .= ''; @@ -337,6 +339,11 @@ ****************************************************/ $morejs = array("/timesheet/core/js/jsparameters.php", "/timesheet/core/js/timesheet.js?".$conf->global->TIMESHEET_VERSION); llxHeader('', $langs->trans('TimesheetToInvoice'), '', '', '', '', $morejs); +print "
"; +$project= new Project($db); +$project->fetch($projectId); +$headProject=project_prepare_head($project); +dol_fiche_head($headProject, 'invoice', $langs->trans("Project"), 0, 'project'); print $Form; //javascript to reload the page with the poject selected print ' @@ -370,16 +377,27 @@ function reload(form) */ function htmlPrintServiceChoice($user, $task, $class, $duration, $tasktimelist, $seller, $buyer) { - global $form, $langs, $conf; + global $form, $langs, $conf, $db; + $taskLabel = ''; $userName = ($user == 'any')?(' - '):print_generic('user', 'rowid', $user, 'lastname', 'firstname', ' '); - $taskLabel = ($task == 'any')?(' - '):print_generic('projet_task', 'rowid', $task, 'ref', 'label', ' '); + if($task == 'any'){ + $taskLabel = ' - '; + $taskHTML = ' - '; + } else { + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + $objtemp = new Task($db); + $objtemp->fetch($task); + $taskLabel = $objtemp->label ; + $taskHTML .= str_replace('classfortooltip', 'classfortooltip colTasks', $objtemp->getNomUrl(0, "withproject", "task", $conf->global->TIMESHEET_HIDE_REF)); + } + $html = '
'.$langs->trans('generalInvoiceProjectParam').'
'.$langs->trans('Project').''; + //$Form .= '
'.$langs->trans('Project').''; //select_generic($table, $fieldValue, $htmlName, $fieldToShow1, $fieldToShow2 = '', $selected = '', $separator = ' - ', $sqlTailWhere = '', $selectparam = '', $addtionnalChoices = array('NULL'=>'NULL'), $sqlTailTable = '', $ajaxUrl = '') - $ajaxNbChar = $conf->global->PROJECT_USE_SEARCH_TO_SELECT; + //$ajaxNbChar = $conf->global->PROJECT_USE_SEARCH_TO_SELECT; //$Form .= select_generic('projet', 'rowid', 'projectid', 'ref', 'title', $projectId, ' - ', $sqlTailWhere, '', null, , $ajaxNbChar); - $htmlProjectArray = array('name'=>'projectid', 'ajaxNbChar'=>$ajaxNbChar, 'otherparam'=>' onchange = "reload(this.form)"'); - $sqlProjectArray = array('table'=>'projet', 'keyfield'=>'t.rowid', 'fields'=>'t.ref, t.title ', 'join'=>$sqlTailJoin, 'where'=>$sqlTailWhere, 'separator' => ' - '); - $Form .= select_sellist($sqlProjectArray, $htmlProjectArray, $projectId); + //$htmlProjectArray = array('name'=>'projectid', 'ajaxNbChar'=>$ajaxNbChar, 'otherparam'=>' onchange = "reload(this.form)"'); + //$sqlProjectArray = array('table'=>'projet', 'keyfield'=>'t.rowid', 'fields'=>'t.ref, t.title ', 'join'=>$sqlTailJoin, 'where'=>$sqlTailWhere, 'separator' => ' - '); + //$Form .= select_sellist($sqlProjectArray, $htmlProjectArray, $projectId); + $Form .= ''; $Form .= '
'.$langs->trans('DateStart').''.$form->select_date($dateStart, 'dateStart', 0, 0, 0, "", 1, 1, 1)."
'.$langs->trans('DateEnd').'
'.$userName; - $html .= ''.$taskLabel; + $html .= ''.$taskHTML; $html .= ''; $html .= ''; $html .= ''; $defaultService = getDefaultService($user, $task); - $addchoices = array('-999'=> $langs->transnoentities('not2invoice'), -1=> $langs->transnoentities('Custom')); + $addchoices = array(0 => $langs->transnoentities('Custom').': '.$taskLabel, '-999'=> $langs->transnoentities('not2invoice')); $ajaxNbChar = $conf->global->PRODUIT_USE_SEARCH_TO_SELECT; $html .= ''; $html .= select_sellist(array('table'=> 'product', 'keyfield'=> 'rowid', 'fields'=>'ref,label', 'where'=>' tosell = 1 AND fk_product_type = 1'), diff --git a/htdocs/timesheet/TimesheetReportProject.php b/htdocs/timesheet/TimesheetReportProject.php index a97c1199..996059cb 100644 --- a/htdocs/timesheet/TimesheetReportProject.php +++ b/htdocs/timesheet/TimesheetReportProject.php @@ -147,14 +147,14 @@ } $Form .= "