Fix navigation on projects

This commit is contained in:
Laurent Destailleur 2017-01-20 10:27:37 +01:00
parent 8ec1784e41
commit 4047de82bd
7 changed files with 29 additions and 26 deletions

View File

@ -5658,10 +5658,15 @@ class Form
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; //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); $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
//$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':''; $navurl = $_SERVER["PHP_SELF"];
//$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':''; // Special case for project/task page
$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</a>':'<span class="inactive">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</span>'; if ($paramid == 'project_ref')
$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(($conf->dol_use_jmobile != 4)?'&gt;':'&nbsp;').'</a>':'<span class="inactive">'.(($conf->dol_use_jmobile != 4)?'&gt;':'&nbsp;').'</span>'; {
$navurl = preg_replace('/\/tasks\/(task|contact|time|note|document).php/','/tasks.php',$navurl);
$paramid='ref';
}
$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</a>':'<span class="inactive">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</span>';
$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(($conf->dol_use_jmobile != 4)?'&gt;':'&nbsp;').'</a>':'<span class="inactive">'.(($conf->dol_use_jmobile != 4)?'&gt;':'&nbsp;').'</span>';
//print "xx".$previous_ref."x".$next_ref; //print "xx".$previous_ref."x".$next_ref;
$ret.='<!-- Start banner content --><div style="vertical-align: middle">'; $ret.='<!-- Start banner content --><div style="vertical-align: middle">';

View File

@ -1091,21 +1091,19 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
} }
} elseif ($link) { } elseif ($link) {
if (dol_mkdir($upload_dir) >= 0) { require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; $linkObject = new Link($db);
$linkObject = new Link($db); $linkObject->entity = $conf->entity;
$linkObject->entity = $conf->entity; $linkObject->url = $link;
$linkObject->url = $link; $linkObject->objecttype = GETPOST('objecttype', 'alpha');
$linkObject->objecttype = GETPOST('objecttype', 'alpha'); $linkObject->objectid = GETPOST('objectid', 'int');
$linkObject->objectid = GETPOST('objectid', 'int'); $linkObject->label = GETPOST('label', 'alpha');
$linkObject->label = GETPOST('label', 'alpha'); $res = $linkObject->create($user);
$res = $linkObject->create($user); $langs->load('link');
$langs->load('link'); if ($res > 0) {
if ($res > 0) { setEventMessages($langs->trans("LinkComplete"), null, 'mesgs');
setEventMessages($langs->trans("LinkComplete"), null, 'mesgs'); } else {
} else { setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors');
setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors');
}
} }
} }
else else

View File

@ -212,7 +212,7 @@ if ($id > 0 || ! empty($ref))
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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 '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';

View File

@ -155,7 +155,7 @@ if ($object->id > 0)
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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 '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';

View File

@ -134,7 +134,7 @@ if ($object->id > 0)
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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 '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';

View File

@ -37,8 +37,8 @@ $langs->load("projects");
$langs->load("companies"); $langs->load("companies");
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$ref=GETPOST("ref",'alpha',1); $ref=GETPOST("ref",'alpha',1); // task ref
$taskref=GETPOST("taskref",'alpha'); $taskref=GETPOST("taskref",'alpha'); // task ref
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$withproject=GETPOST('withproject','int'); $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').")"; $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 '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';

View File

@ -324,7 +324,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'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 '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';