From 4047de82bdead67aa80e881b52fce8ecd31ab7a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Jan 2017 10:27:37 +0100 Subject: [PATCH] Fix navigation on projects --- htdocs/core/class/html.form.class.php | 13 +++++++++---- htdocs/core/lib/files.lib.php | 28 +++++++++++++-------------- htdocs/projet/tasks/contact.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/projet/tasks/note.php | 2 +- htdocs/projet/tasks/task.php | 6 +++--- htdocs/projet/tasks/time.php | 2 +- 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 591402bbdea..e4049dd85ff 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5658,10 +5658,15 @@ class Form //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); - //$previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; - //$next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; - $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; - $next_ref = $object->ref_next?''.(($conf->dol_use_jmobile != 4)?'>':' ').'':''.(($conf->dol_use_jmobile != 4)?'>':' ').''; + $navurl = $_SERVER["PHP_SELF"]; + // Special case for project/task page + if ($paramid == 'project_ref') + { + $navurl = preg_replace('/\/tasks\/(task|contact|time|note|document).php/','/tasks.php',$navurl); + $paramid='ref'; + } + $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; + $next_ref = $object->ref_next?''.(($conf->dol_use_jmobile != 4)?'>':' ').'':''.(($conf->dol_use_jmobile != 4)?'>':' ').''; //print "xx".$previous_ref."x".$next_ref; $ret.='
'; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 2744946e215..ed0e0725bed 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1091,21 +1091,19 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio } } elseif ($link) { - if (dol_mkdir($upload_dir) >= 0) { - require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; - $linkObject = new Link($db); - $linkObject->entity = $conf->entity; - $linkObject->url = $link; - $linkObject->objecttype = GETPOST('objecttype', 'alpha'); - $linkObject->objectid = GETPOST('objectid', 'int'); - $linkObject->label = GETPOST('label', 'alpha'); - $res = $linkObject->create($user); - $langs->load('link'); - if ($res > 0) { - setEventMessages($langs->trans("LinkComplete"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors'); - } + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $linkObject = new Link($db); + $linkObject->entity = $conf->entity; + $linkObject->url = $link; + $linkObject->objecttype = GETPOST('objecttype', 'alpha'); + $linkObject->objectid = GETPOST('objectid', 'int'); + $linkObject->label = GETPOST('label', 'alpha'); + $res = $linkObject->create($user); + $langs->load('link'); + if ($res > 0) { + setEventMessages($langs->trans("LinkComplete"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors'); } } else diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index ebc486fec7e..060155d6507 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -212,7 +212,7 @@ if ($id > 0 || ! empty($ref)) $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 0108f754293..d985454119d 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -155,7 +155,7 @@ if ($object->id > 0) $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 0c4ab4b707f..f595f43bc2b 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -134,7 +134,7 @@ if ($object->id > 0) $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 3c6f9bb7e6e..cc0eb0fed6f 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -37,8 +37,8 @@ $langs->load("projects"); $langs->load("companies"); $id=GETPOST('id','int'); -$ref=GETPOST("ref",'alpha',1); -$taskref=GETPOST("taskref",'alpha'); +$ref=GETPOST("ref",'alpha',1); // task ref +$taskref=GETPOST("taskref",'alpha'); // task ref $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); @@ -246,7 +246,7 @@ if ($id > 0 || ! empty($ref)) $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 49d57ae946e..6cb52588a89 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -324,7 +324,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - dol_banner_tab($projectstatic, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
';