diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index e91e43a7739..a1738474459 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -39,7 +39,7 @@ //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler //if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header X-Frame-Options: SAMEORIGIN but ALLOWALL +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' // Load Dolibarr environment $res=0; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 05ac4f25490..4319a11eb03 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -37,14 +37,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; // Load translation files required by the page $langs->load('projects'); -$id=GETPOST('id','int'); -$projectid=GETPOST('projectid','int'); -$ref=GETPOST('ref','alpha'); -$action=GETPOST('action','alpha'); -$confirm=GETPOST('confirm','alpha'); -$cancel=GETPOST('cancel','alpha'); -$withproject=GETPOST('withproject','int'); -$project_ref=GETPOST('project_ref','alpha'); +$action = GETPOST('action','alpha'); +$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists) +$confirm = GETPOST('confirm','alpha'); +$cancel = GETPOST('cancel','alpha'); +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search +$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page + +$id = GETPOST('id','int'); +$projectid = GETPOST('projectid','int'); +$ref = GETPOST('ref','alpha'); +$withproject= GETPOST('withproject','int'); +$project_ref= GETPOST('project_ref','alpha'); $search_day=GETPOST('search_day','int'); $search_month=GETPOST('search_month','int'); @@ -57,6 +62,7 @@ $search_value=GETPOST('search_value','int'); $search_task_ref=GETPOST('search_task_ref','alpha'); $search_task_label=GETPOST('search_task_label','alpha'); $search_user=GETPOST('search_user','int'); +$search_valuebilled=GETPOST('search_valuebilled', 'int'); // Security check $socid=0; @@ -116,6 +122,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_task_ref=''; $search_task_label=''; $search_user=0; + $search_valuebilled=''; $toselect=''; $search_array_options=array(); $action=''; @@ -294,6 +301,8 @@ elseif (GETPOST('project_ref','alpha')) * View */ +$arrayofselected=is_array($toselect)?$toselect:array(); + llxHeader("",$langs->trans("Task")); $form = new Form($db); @@ -683,6 +692,17 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } } + if (! empty($withproject) && $projectstatic->bill_time) + { + $arrayofmassactions = array( + 'generateinvoice'=>$langs->trans("GenerateInvoice"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete"); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + } + /* * List of time spent */ @@ -703,6 +723,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label); if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user); + if ($search_valuebilled == '1') $sql .= ' AND t.invoice_id > 0'; + if ($search_valuebilled == '0') $sql .= ' AND (t.invoice_id = 0 OR t.invoice_id IS NULL)'; if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) @@ -732,7 +754,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $title=$langs->trans("ListTaskTimeUserProject"); //$linktotasks=''.$langs->trans("GoToListOfTasks").''; //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktocreatetime, 'title_generic.png'); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $linktocreatetime, '', $limit); } $i = 0; @@ -827,7 +849,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Invoiced if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print '