Skip to content

Commit

Permalink
4.6.3 (#214)
Browse files Browse the repository at this point in the history
* fix timestamp error

* 4.6.2 : warning and crfs

* 4.6.3
  • Loading branch information
delcroip authored Mar 22, 2023
1 parent 9ab32cb commit a0ea21e
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 68 deletions.
6 changes: 5 additions & 1 deletion htdocs/timesheet/AttendanceEventAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$view = GETPOST('view', 'alpha');
if ($view != ''){
$action = $view;
}
$backtopage = GETPOST('backtopage');
$cancel = GETPOST('cancel');
$confirm = GETPOST('confirm');
Expand Down Expand Up @@ -458,7 +462,7 @@ function init_myfunc()
print '</td>';
print '</tr>'."\n";
$i = 0;
// $basedurl = dirname($PHP_SELF).'/attendanceeventCard.php?action=view&id=';
// $basedurl = dirname($PHP_SELF).'/attendanceeventCard.php?view=card&id=';
while($i < $num && $i<$limit)
{
$obj = $db->fetch_object($resql);
Expand Down
16 changes: 12 additions & 4 deletions htdocs/timesheet/Timesheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
require_once 'core/lib/timesheet.lib.php';
require_once 'class/TimesheetUserTasks.class.php';
$action = GETPOST('action', 'alpha');
$view = GETPOST('view', 'alpha');

if ($view != ''){
$action = $view;
}

$datestart = GETPOST('dateStart', 'int');
//should return the XMLDoc
$ajax = GETPOST('ajax', 'int');
Expand All @@ -37,10 +43,11 @@
//$toDate = GETPOST('toDate');
$toDate = GETPOST('toDate', 'alpha')?:'';

$toDateday = (!empty($toDate) && $action == 'goToDate')?GETPOST('toDateday', 'int') :0;// to not look for the date if action not goTodate
$toDateday = (!empty($toDate) && $action == 'goToDate')?GETPOST('toDateday', 'int') :0;// to not look for the date if action not goToDate
$toDatemonth = (!empty($toDate) && $action == 'goToDate')?GETPOST('toDatemonth', 'int'):0;
$toDateyear = (!empty($toDate) && $action == 'goToDate')?GETPOST('toDateyear', 'int'):0;


$token = GETPOST('token', 'alpha');
$whitelistmode = GETPOST('wlm', 'int');
if ($whitelistmode == '') {
Expand Down Expand Up @@ -76,15 +83,16 @@
}
}
$confirm = GETPOST('confirm', 'alpha');
$dateStart = intval(GETPOST('startDate', 'int'));
$dateStart = intval(GETPOST('dateStart', 'int'));
if ($dateStart == 0){
if ($toDateday == 0 && $datestart == 0 && isset($_SESSION["dateStart"])) {
$dateStart = $_SESSION["dateStart"];
} else{
$dateStart = parseDate($toDateday, $toDatemonth, $toDateyear, $datestart);
if ($dateStart == 0)$dateStart = getStartDate(time(), 0);
$dateStart = parseDate($toDateday, $toDatemonth, $toDateyear);

}
}
if ($dateStart == 0)$dateStart = getStartDate(time(), 0);
$_SESSION["dateStart"] = $dateStart ;

// Load traductions files requiredby by page
Expand Down
27 changes: 16 additions & 11 deletions htdocs/timesheet/TimesheetFavouriteAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
$ls_date_end_year = GETPOST('ls_date_end_year', 'int');
}
$page = GETPOST('page', 'int');
$view = GETPOST('view', 'alpha');
if ($view != ''){
$action = $view;
}
if ($page <= 0){
$page = 0;
}
Expand Down Expand Up @@ -171,7 +175,7 @@
}
case 'delete':
if (isset($_GET['urlfile'])) $action = 'deletefile';
case 'view':
case 'card':
case 'viewinfo':
case 'viewdoc':
case 'edit':
Expand Down Expand Up @@ -203,7 +207,8 @@


if ($ajax == 1) {
echo json_encode(array('id'=> $result));
ob_flush();
echo @json_encode(array('id'=> $result));
ob_end_flush();
exit();
} else{
Expand Down Expand Up @@ -296,7 +301,7 @@ function init_myfunc()
if ($ret == 'html') print '<br />';
//to have the object to be deleted in the background\
}
case 'view':
case 'card':
// tabs
if ($edit == 0 && $new == 0) {
//show tabs
Expand All @@ -317,7 +322,7 @@ function init_myfunc()
} else {
// show the nav bar
$basedurltab = explode("?", $PHP_SELF);
$basedurl = $basedurltab[0].'?action=list';
$basedurl = $basedurltab[0].'?view=list';
$linkback = '<a href = "'.$basedurl.(! empty($socid)?'?socid='.$socid:'').'">'
.$langs->trans("BackToList").'</a>';
if (!isset($object->ref))//save ref if any
Expand Down Expand Up @@ -694,7 +699,7 @@ function init_myfunc()
print '</tr>'."\n";
$i = 0;
$basedurltab = explode("?", $PHP_SELF);
$basedurl = $basedurltab[0].'?action=view&id=';
$basedurl = $basedurltab[0].'?view=card&id=';
while($i < $num && $i<$limit)
{
$obj = $db->fetch_object($resql);
Expand Down Expand Up @@ -738,11 +743,11 @@ function reloadpage($backtopage = "", $id = "", $ref = "")
if (!empty($backtopage)) {
header("Location: ".$backtopage);
} elseif (!empty($ref)) {
header("Location: ".$_SERVER["PHP_SELF"].'?action=view&ref='.$id);
header("Location: ".$_SERVER["PHP_SELF"].'?view=card&ref='.$id);
} elseif ($id>0) {
header("Location: ".$_SERVER["PHP_SELF"].'?action=view&id='.$id);
header("Location: ".$_SERVER["PHP_SELF"].'?view=card&id='.$id);
} else{
header("Location: ".$_SERVER["PHP_SELF"].'?action=list');
header("Location: ".$_SERVER["PHP_SELF"].'?view=list');
}
ob_end_flush();
exit();
Expand All @@ -760,7 +765,7 @@ function timesheetFavourite_prepare_head($object)
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = $_SERVER["PHP_SELF"].'?action=view&id='.$object->id;
$head[$h][0] = $_SERVER["PHP_SELF"].'?view=card&id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
Expand All @@ -771,11 +776,11 @@ function timesheetFavourite_prepare_head($object)
complete_head_from_modules($conf, $langs, $object, $head, $h, 'timesheet');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'timesheet', 'remove');
/*
$head[$h][0] = $_SERVER["PHP_SELF"].'?action=viewdoc&id='.$object->id;
$head[$h][0] = $_SERVER["PHP_SELF"].'?view=carddoc&id='.$object->id;
$head[$h][1] = $langs->trans("Documents");
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = $_SERVER["PHP_SELF"].'?action=viewinfo&id='.$object->id;
$head[$h][0] = $_SERVER["PHP_SELF"].'?view=cardinfo&id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
Expand Down
10 changes: 7 additions & 3 deletions htdocs/timesheet/TimesheetOtherApproval.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
// end find the role
// get other param
$action = GETPOST('action', 'alpha');
$view = GETPOST('view', 'alpha');
if ($view != ''){
$action = $view;
}
$offset = GETPOST('offset', 'int');
if (!is_numeric($offset))$offset = 0;
$optioncss = GETPOST('optioncss', 'alpha');
Expand Down Expand Up @@ -204,20 +208,20 @@ function getHTMLNavigation($role, $optioncss, $selectList,$token, $current = 0)
$form = new Form($db);
$Nav = '<table class = "noborder" width = "50%">'."\n\t".'<tr>'."\n\t\t".'<th>'."\n\t\t\t";
if ($current!=0) {
$Nav .= '<a href="?action=goTo&token='.$token.'&target='.($current-1);
$Nav .= '<a href="?view=goto&token='.$token.'&target='.($current-1);
$Nav .= '&role='.($role);
if ($optioncss != '')$Nav .= '&amp;optioncss='.$optioncss;
$Nav .= '"> &lt;&lt;'.$langs->trans("Previous").' </a>'."\n\t\t";
}
$Nav .= "</th>\n\t\t<th>\n\t\t\t";
$Nav .= '<form name = "goTo" action="?action=goTo&role='.$role.'" method = "POST" >'."\n\t\t\t";
$Nav .= '<form name = "goTo" action="?view=goto&role='.$role.'" method = "POST" >'."\n\t\t\t";
$Nav .= $langs->trans("GoTo").': '.$htmlSelect."\n\t\t\t";
$Nav .= '<input type = "hidden" id="csrf-token" name = "token" value = "'.$token.'"/>';
$Nav .= '<input type = "submit" value = "Go" /></form>'."\n\t\t</th>\n\t\t<th>\n\t\t\t";


if ($current<count($selectList)) {
$Nav .= '<a href="?action=goTo&token='.$token.'&target='.($current+1);
$Nav .= '<a href="?view=goto&token='.$token.'&target='.($current+1);
$Nav .= '&role='.($role);
if ($optioncss != '') $Nav .= '&amp;optioncss='.$optioncss;
$Nav .= '">'.$langs->trans("Next").' &gt;&gt;</a>';
Expand Down
22 changes: 14 additions & 8 deletions htdocs/timesheet/TimesheetProjectInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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';
$PHP_SELF = $_SERVER['PHP_SELF'];
//get param
$staticProject = new Project($db);
$projectId = GETPOST('projectid', 'int');
Expand All @@ -45,12 +46,16 @@
//init handling object
$form = new Form($db);
$dateStart = strtotime(GETPOST('dateStart', 'alpha'));
$dateStartday = GETPOST('dateStartday', 'int');// to not look for the date if action not goTodate
$dateStartday = GETPOST('dateStartday', 'int');// to not look for the date if action not goToDate
$dateStartmonth = GETPOST('dateStartmonth', 'int');
$dateStartyear = GETPOST('dateStartyear', 'int');


$dateStart = parseDate($dateStartday, $dateStartmonth, $dateStartyear, $dateStart);


$dateEnd = strtotime(GETPOST('dateEnd', 'alpha'));
$dateEndday = GETPOST('dateEndday', 'int');// to not look for the date if action not goTodate
$dateEndday = GETPOST('dateEndday', 'int');// to not look for the date if action not goToDate
$dateEndmonth = GETPOST('dateEndmonth', 'int');
$dateEndyear = GETPOST('dateEndyear', 'int');
$dateEnd = parseDate($dateEndday, $dateEndmonth, $dateEndyear, $dateEnd);
Expand All @@ -70,7 +75,7 @@
$langs->load('timesheet@timesheet');
//steps
switch($step) {
case 2:{
case 2:
$fields = ($mode == 'user')?'fk_user':(($mode == 'taskUser')?'fk_user, fk_task':'fk_task');
$sql = 'SELECT '.$fields.', SUM(tt.task_duration) as duration, ';
if ($db->type!='pgsql') {
Expand Down Expand Up @@ -170,7 +175,7 @@
}
$Form .= '</table>';
$Form .= '<input type = "submit" class = "butAction" value = "'.$langs->trans('Next')."\">\n</form>";
break;}
break;
case 3: // review choice and list of item + quantity(editable)
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
Expand Down Expand Up @@ -306,8 +311,9 @@
if ($result>0)$propallines[$lineCount] = $result;
}
}

echo "step 3<br>";
if ($id > 0 && is_array($resArray)) {
echo "step 3.1<br>";
$db->commit();
$invoicecard = str_replace(
array("require '../../main.inc.php';","<?php","\$db->close();"),
Expand Down Expand Up @@ -623,7 +629,7 @@
$project->fetch($projectId);
$headProject = project_prepare_head($project);
dol_fiche_head($headProject, 'invoice', $langs->trans("Project"), 0, 'project');

$ref = GETPOST('ref', 'alpha');
// Load object
if ($projectId > 0 || !empty($ref))
{
Expand All @@ -634,7 +640,7 @@
$id = $project->id;
}
}
$ref = GETPOST('ref', 'alpha');

$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

$morehtmlref = '<div class="refidno">';
Expand Down Expand Up @@ -698,7 +704,7 @@ function htmlPrintServiceChoice($user, $task, $class, $duration, $tasktimelist,
$objtemp = new Task($db);
$objtemp->fetch($task);
$taskLabel = $objtemp->label ;
$taskHTML .= str_replace('classfortooltip', 'classfortooltip colTasks',
$taskHTML = str_replace('classfortooltip', 'classfortooltip colTasks',
$objtemp->getNomUrl(0, "withproject", "task", getConf('TIMESHEET_HIDE_REF')));
}

Expand Down
8 changes: 6 additions & 2 deletions htdocs/timesheet/TimesheetReportProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
//$objmodelexport = new ModeleExports($db);
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$view = GETPOST('view', 'alpha');
if ($view != ''){
$action = $view;
}
//$dateStart = GETPOST('dateStart', 'alpha');
$exportfriendly = GETPOST('exportfriendly', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
Expand Down Expand Up @@ -71,12 +75,12 @@

//find the right week
$dateStart = strtotime(GETPOST('dateStart', 'alpha'));
$dateStartday = GETPOST('dateStartday', 'int');// to not look for the date if action not goTodate
$dateStartday = GETPOST('dateStartday', 'int');// to not look for the date if action not goToDate
$dateStartmonth = GETPOST('dateStartmonth', 'int');
$dateStartyear = GETPOST('dateStartyear', 'int');
$dateStart = parseDate($dateStartday, $dateStartmonth, $dateStartyear, $dateStart);
$dateEnd = strtotime(GETPOST('dateEnd', 'alpha'));
$dateEndday = GETPOST('dateEndday', 'int');// to not look for the date if action not goTodate
$dateEndday = GETPOST('dateEndday', 'int');// to not look for the date if action not goToDate
$dateEndmonth = GETPOST('dateEndmonth', 'int');
$dateEndyear = GETPOST('dateEndyear', 'int');
$hidetab = GETPOST('hidetab', 'int');
Expand Down
10 changes: 7 additions & 3 deletions htdocs/timesheet/TimesheetReportUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
$userid = is_object($user)?$user->id:$user;
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$view = GETPOST('view', 'alpha');
if ($view != ''){
$action = $view;
}
$userIdSelected = GETPOST('userSelected', 'int');
$exportFriendly = GETPOST('exportFriendly', 'alpha');
if (empty($userIdSelected))$userIdSelected = $userid;
Expand All @@ -51,7 +55,7 @@

//find the right week
//$toDate = GETPOST('toDate', 'alpha');
//$toDateday = (!empty($toDate) && $action == 'goToDate')? GETPOST('toDateday', 'int'):0;// to not look for the date if action not goTodate
//$toDateday = (!empty($toDate) && $action == 'goToDate')? GETPOST('toDateday', 'int'):0;// to not look for the date if action not goToDate
//$toDatemonth = GETPOST('toDatemonth', 'int');
//$toDateyear = GETPOST('toDateyear', 'int');
$mode = GETPOST('mode', 'alpha');
Expand All @@ -75,12 +79,12 @@
//$firstDay = ($month)?strtotime('01-'.$month.'-'. $year):strtotime('first day of previous month');
//$lastDay = ($month)?strtotime('last day of this month', $firstDay):strtotime('last day of previous month');
$dateStart = strtotime(GETPOST('dateStart', 'alpha'));
$dateStartday = GETPOST('dateStartday', 'int');// to not look for the date if action not goTodate
$dateStartday = GETPOST('dateStartday', 'int');// to not look for the date if action not goToDate
$dateStartmonth = GETPOST('dateStartmonth', 'int');
$dateStartyear = GETPOST('dateStartyear', 'int');
$dateStart = parseDate($dateStartday, $dateStartmonth, $dateStartyear, $dateStart);
$dateEnd = strtotime(GETPOST('dateEnd', 'alpha'));
$dateEndday = GETPOST('dateEndday', 'int');// to not look for the date if action not goTodate
$dateEndday = GETPOST('dateEndday', 'int');// to not look for the date if action not goToDate
$dateEndmonth = GETPOST('dateEndmonth', 'int');
$reporttab = GETPOST('reporttab', 'alpha');
$dateEndyear = GETPOST('dateEndyear', 'int');
Expand Down
10 changes: 7 additions & 3 deletions htdocs/timesheet/TimesheetTeamApproval.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
//$userId = GETPOST('userid');
$userId = is_object($user)?$user->id:$user;
$action = GETPOST('action', 'alpha');
$view = GETPOST('view', 'alpha');
if ($view != ''){
$action = $view;
}
//should return the XMLDoc
$ajax = GETPOST('ajax', 'int');
$xml = GETPOST('xml', 'int');
Expand Down Expand Up @@ -366,18 +370,18 @@ function getHTMLNavigation($optioncss, $selectList, $token, $current = 0)
$form = new Form($db);
$Nav = '<table class = "noborder" width = "50%">'."\n\t".'<tr>'."\n\t\t".'<th>'."\n\t\t\t";
if ($current!=0) {
$Nav .= '<a href="?action=goTo&token='.$token.'&target='.($current-1).'"';
$Nav .= '<a href="?view=goto&token='.$token.'&target='.($current-1).'"';
if ($optioncss != '')$Nav .= '&amp;optioncss='.$optioncss;
$Nav .= '"> &lt;&lt;'.$langs->trans("Previous").' </a>'."\n\t\t";
}
$Nav .= "</th>\n\t\t<th>\n\t\t\t";
$Nav .= '<form name = "goTo" action="?action=goTo&token='.$token.'" method = "POST" >'."\n\t\t\t";
$Nav .= '<form name = "goTo" action="?view=goto&token='.$token.'" method = "POST" >'."\n\t\t\t";
$Nav .= '<input type = "hidden" id="csrf-token" name = "token" value = "'.$token.'"/>';

$Nav .= $langs->trans("GoTo").': '.$htmlSelect."\n\t\t\t";;
$Nav .= '<input type = "submit" value = "Go" /></form>'."\n\t\t</th>\n\t\t<th>\n\t\t\t";
if ($current<count($selectList)) {
$Nav .= '<a href="?action=goTo&token='.$token.'&target='.($current+1);
$Nav .= '<a href="?view=goto&token='.$token.'&target='.($current+1);
if ($optioncss != '') $Nav .= '&amp;optioncss='.$optioncss;
$Nav .= '">'.$langs->trans("Next").' &gt;&gt;</a>';
}
Expand Down
Loading

0 comments on commit a0ea21e

Please sign in to comment.