';
// Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
@@ -458,7 +470,7 @@ if ($id > 0)
}
}
$morehtmlref.='
';
-
+
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@@ -652,7 +664,7 @@ if ($id > 0)
while ($i < $num)
{
$objp = $db->fetch_object($resql);
-
+
print '";
print $object->description;
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index e9ae9073835..d0b58c9909c 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -57,7 +57,7 @@ $hookmanager->initHooks(array('productdocuments'));
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 57545b07948..41c03756a44 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -40,7 +40,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = (GETPOST("page",'int')?GETPOST("page", 'int'):0);
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/list-with-listview.php b/htdocs/product/list-with-listview.php
index 1ebbf256c9c..512ae6d08a1 100644
--- a/htdocs/product/list-with-listview.php
+++ b/htdocs/product/list-with-listview.php
@@ -81,7 +81,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = (GETPOST("page",'int')?GETPOST("page", 'int'):0);
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 74f9c59cff3..7db6e876cf1 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -81,7 +81,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = (GETPOST("page",'int')?GETPOST("page", 'int'):0);
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php
index 5320e637316..79b347019d3 100644
--- a/htdocs/product/popuprop.php
+++ b/htdocs/product/popuprop.php
@@ -42,7 +42,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (! $sortfield) $sortfield="c";
if (! $sortorder) $sortorder="DESC";
$offset = $limit * $page ;
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 1c72d5f6615..0e6056b91da 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -52,7 +52,7 @@ $mesg = '';
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index e2f5bccc430..1df5e9fa02f 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -49,7 +49,7 @@ $mesg = '';
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 506689a6001..06fd9d64916 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -53,7 +53,7 @@ $showmessage=GETPOST('showmessage');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index ac2849fefcf..03979f3e9d3 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -54,7 +54,7 @@ $mesg = '';
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 78d3c470cb1..7ea0800625f 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -65,7 +65,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 1a3d7c9edb2..006f882b820 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -64,7 +64,7 @@ $texte = '';
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
-if ($page == -1) { $page = 0; }
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page ;
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index a2b3f1cc667..9cda69560d5 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load('projects');
+$langs->load('users');
$action=GETPOST('action','aZ09');
$mode=GETPOST("mode");
@@ -62,6 +63,8 @@ $month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("mo
$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d"));
$day = (int) $day;
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
+
+$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
$search_task_ref=GETPOST('search_task_ref', 'alpha');
$search_task_label=GETPOST('search_task_label', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
@@ -75,6 +78,17 @@ $daytoparse = $now;
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'
+if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
+{
+ $usertoprocess=$user;
+}
+else
+{
+ $usertoprocess=new User($db);
+ $usertoprocess->fetch($search_usertoprocessid);
+}
+$search_usertoprocessid=$usertoprocess->id;
+
$object=new Task($db);
@@ -83,9 +97,10 @@ $object=new Task($db);
*/
// Purge criteria
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$action = '';
+ $search_usertoprocessid = '';
$search_task_ref = '';
$search_task_label = '';
$search_project_ref = '';
@@ -125,7 +140,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
}
if (! $error)
{
- $idfortaskuser=$user->id;
+ $idfortaskuser=$usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
@@ -143,7 +158,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
$project->fetch($object->fk_project);
// Get type
$listofprojcontact=$project->liste_type_contact('internal');
-
+
if (count($listofprojcontact))
{
$typeforprojectcontact=reset(array_keys($listofprojcontact));
@@ -151,7 +166,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
}
}
}
- else
+ else
{
dol_print_error($db);
}
@@ -175,6 +190,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
if (! $error)
{
setEventMessages("TaskAssignedToEnterTime", null);
+ $taskid=0;
}
$action='';
@@ -247,12 +263,12 @@ if ($action == 'addtime' && $user->rights->projet->lire)
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back
- header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
+ header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
exit;
}
}
- else
- {
+ else
+ {
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
}
}
@@ -286,8 +302,6 @@ $next_day = $next['mday'];
$title=$langs->trans("TimeSpent");
if ($mine) $title=$langs->trans("MyTimeSpent");
-$usertoprocess = $user;
-
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
if ($id)
@@ -314,8 +328,9 @@ llxHeader("",$title,"");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param='';
-$param.=($mode?'&mode='.$mode:'');
-$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
+$param.=($mode?'&mode='.$mode:'');
+$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
+$param.=($search_userassignedid > 0?'&search_userassignedid='.$search_usertoprocessid:'');
// Show navigation bar
$nav =''.img_previous($langs->trans("Previous"))." \n";
@@ -337,7 +352,7 @@ print ' ';
print ' ';
print ' ';
-$head=project_timesheet_prepare_head($mode);
+$head=project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperday', '', -1, 'task');
// Show description of content
@@ -360,45 +375,17 @@ print '';
dol_fiche_end();
-
-// Filter on user
-/* dol_fiche_head('');
- print ''.$langs->trans("User").' ';
- print '';
- if ($mine) print $user->getLoginUrl(1);
- print ' ';
- print '
';
- dol_fiche_end();
-*/
-
-// Filter on user
-/* dol_fiche_head('');
- print ''.$langs->trans("User").' ';
- print '';
- if ($mine) print $user->getLoginUrl(1);
- print ' ';
- print '
';
- dol_fiche_end();
-*/
-
-
-// Add a new project/task
-//print ' ';
-//print '