Skip to content

Commit

Permalink
Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 11, 2018
2 parents b47e7b2 + a107d16 commit 434cf2e
Show file tree
Hide file tree
Showing 19 changed files with 337 additions and 191 deletions.
67 changes: 46 additions & 21 deletions htdocs/admin/menus/edit.php
Expand Up @@ -96,6 +96,7 @@
$menu->perms=GETPOST('perms','alpha');
$menu->target=GETPOST('target','alpha');
$menu->user=GETPOST('user','alpha');
$menu->mainmenu=GETPOST('propertymainmenu','alpha');
if (is_numeric(GETPOST('menuIdParent','alpha')))
{
$menu->fk_menu=GETPOST('menuIdParent','alpha');
Expand Down Expand Up @@ -123,14 +124,11 @@
setEventMessages($menu->error, $menu->errors, 'errors');
}
$action = "edit";
}
else
{

header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;
}

if ($_GET['return'])
else
{
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;
Expand Down Expand Up @@ -215,6 +213,7 @@
$menu->perms=GETPOST('perms','alpha');
$menu->target=GETPOST('target','alpha');
$menu->user=GETPOST('user','alpha');
$menu->mainmenu=GETPOST('propertymainmenu','alpha');
if (is_numeric(GETPOST('menuId','int')))
{
$menu->fk_menu=GETPOST('menuId','int');
Expand Down Expand Up @@ -289,10 +288,13 @@ function init_topleft()
{
jQuery("#menuId").prop("disabled", true);
jQuery("#menuId").val(\'\');
jQuery("#propertymainmenu").removeAttr("disabled");
jQuery("#propertymainmenu").val(\'\');
}
else
if (jQuery("#topleft").val() == \'left\')
{
jQuery("#menuId").removeAttr("disabled");
jQuery("#propertymainmenu").prop("disabled", true);
}
}
init_topleft();
Expand Down Expand Up @@ -338,7 +340,7 @@ function init_topleft()
print '</td>';
print '<td>'.$langs->trans('DetailMenuHandler').'</td></tr>';

//User
// User
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td>';
print '<td><select class="flat" name="user">';
print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>';
Expand All @@ -362,9 +364,15 @@ function init_topleft()
print '<option value="left"'.($_POST["type"] && $_POST["type"]=='left'?' selected':'').'>'.$langs->trans('Left').'</option>';
print '</select>';
}
// print '<input type="text" size="50" name="type" value="'.$type.'">';
print '</td><td>'.$langs->trans('DetailType').'</td></tr>';

// Mainmenu code
print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alpha')?GETPOST("propertymainmenu", 'alpha'):'').'"></td>';
print '<td>';
print $langs->trans("Example").': mytopmenukey';
print '</td></tr>';

// MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
if ($parent_rowid)
Expand All @@ -373,23 +381,23 @@ function init_topleft()
}
else
{
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
print '<td><input type="text" class="minwidth300" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
}
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>';

// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';

// URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="minwidth500" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';

// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" class="minwidth300" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';

// Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" class="width100" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';

// Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
Expand All @@ -398,10 +406,10 @@ function init_topleft()
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';

// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" class="minwidth500" name="enabled" value="'.(GETPOSTISSET('enabled')?GETPOST("enabled",'alpha'):'1').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';

// Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" class="minwidth500" name="perms" value="'.(GETPOSTISSET('perms')?GETPOST('perms','alpha'):'1').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';

print '</table>';

Expand Down Expand Up @@ -455,13 +463,30 @@ function init_topleft()
// Type
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';

// Mainmenu code
if ($menu->type == 'top')
{
print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
/*if ($parent_rowid)
{
print '<td>'.$parent_rowid.'<input type="hidden" name="propertyleftmenu" value="'.$parent_rowid.'"></td>';
}
else
{*/
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alpha')?GETPOST("propertymainmenu", 'alpha'):$menu->mainmenu).'"></td>';
//}
print '<td>';
print $langs->trans("Example").': mytopmenukey';
print '</td></tr>';
}

// MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
print '</td>';
$valtouse=$menu->fk_menu;
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" size="48"></td>';
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" class="minwidth300"></td>';
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>';
Expand All @@ -470,16 +495,16 @@ function init_topleft()
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';

// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';

// Url
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';

// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';

// Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" class="minwidth100" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';

// Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
Expand All @@ -488,12 +513,12 @@ function init_topleft()
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';

// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
if (! empty($menu->enabled)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->enabled,1)).')';
print '</td></tr>';

// Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
if (! empty($menu->perms)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->perms,1)).')';
print '</td></tr>';

Expand Down
6 changes: 4 additions & 2 deletions htdocs/comm/mailing/cibles.php
Expand Up @@ -329,14 +329,16 @@
// Si le module mailing est qualifie
if ($qualified)
{
$var = ! $var;

if ($allowaddtarget)
{
print '<form class="oddeven tagtr" name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
else
{
print '<div class="oddeven tagtr">';
print '<div '.$bctag[$var].'>';
}

print '<div class="tagtd">';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/events.class.php
Expand Up @@ -76,9 +76,9 @@ class Events // extends CommonObject

// List of all Audit/Security events supported by triggers
public $eventstolog=array(
/*array('id'=>'USER_LOGIN', 'test'=>1),
array('id'=>'USER_LOGIN', 'test'=>1),
array('id'=>'USER_LOGIN_FAILED', 'test'=>1),
array('id'=>'USER_LOGOUT', 'test'=>1),*/
array('id'=>'USER_LOGOUT', 'test'=>1),
array('id'=>'USER_CREATE', 'test'=>1),
array('id'=>'USER_MODIFY', 'test'=>1),
array('id'=>'USER_NEW_PASSWORD', 'test'=>1),
Expand Down
14 changes: 7 additions & 7 deletions htdocs/core/class/html.formprojet.class.php
Expand Up @@ -334,7 +334,7 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24,
$out='';

$hideunselectables = false;
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;

if (empty($projectsListId))
{
Expand All @@ -346,11 +346,11 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24,
}

// Search all projects
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,';
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,';
$sql.= ' s.nom as name';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc';
$sql.= ', '.MAIN_DB_PREFIX.'projet_task as t';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
$sql.= ' '.MAIN_DB_PREFIX.'projet_task as t';
$sql.= " WHERE p.entity IN (".getEntity('project').")";
$sql.= " AND t.fk_projet = p.rowid";
if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
Expand Down Expand Up @@ -393,7 +393,7 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24,
}
else
{
if ($discard_closed == 1 && $obj->fk_statut == 2)
if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED)
{
$i++;
continue;
Expand All @@ -411,12 +411,12 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24,
if ($obj->name) $labeltoshow.=' ('.$obj->name.')';

$disabled=0;
if ($obj->fk_statut == 0)
if ($obj->fk_statut == Project::STATUS_DRAFT)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
}
else if ($obj->fk_statut == 2)
else if ($obj->fk_statut == Project::STATUS_CLOSED)
{
if ($discard_closed == 2) $disabled=1;
$labeltoshow.=' - '.$langs->trans("Closed");
Expand Down
1 change: 0 additions & 1 deletion htdocs/core/class/menubase.class.php
Expand Up @@ -589,7 +589,6 @@ function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu

$a = 0;
$b = 0;
$oldrowid=0;
while ($a < $numa)
{
//$objm = $this->db->fetch_object($resql);
Expand Down
76 changes: 38 additions & 38 deletions htdocs/core/lib/project.lib.php
Expand Up @@ -52,9 +52,44 @@ function project_prepare_head($object)
$head[$h][2] = 'contact';
$h++;

if (empty($conf->global->PROJECT_HIDE_TASKS))
{
// Then tab for sub level of projet, i mean tasks
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id;
$head[$h][1] = $langs->trans("Tasks");

require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic=new Task($db);
$nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0));
if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
$head[$h][2] = 'tasks';
$h++;

$nbTimeSpent=0;
$sql = "SELECT t.rowid";
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " WHERE t.fk_task = pt.rowid";
$sql .= " AND pt.fk_projet =".$object->id;
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj) $nbTimeSpent=1;
}
else dol_print_error($db);

$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
$head[$h][1] = $langs->trans("TimeSpent");
if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>';
$head[$h][2] = 'timespent';
$h++;
}

if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)
|| ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled)
|| ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled))
|| ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled)
|| ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id;
$head[$h][1] = $langs->trans("ProjectOverview");
Expand Down Expand Up @@ -92,41 +127,6 @@ function project_prepare_head($object)
$head[$h][2] = 'document';
$h++;

if (empty($conf->global->PROJECT_HIDE_TASKS))
{
// Then tab for sub level of projet, i mean tasks
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id;
$head[$h][1] = $langs->trans("Tasks");

require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic=new Task($db);
$nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0));
if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
$head[$h][2] = 'tasks';
$h++;

$nbTimeSpent=0;
$sql = "SELECT t.rowid";
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " WHERE t.fk_task = pt.rowid";
$sql .= " AND pt.fk_projet =".$object->id;
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj) $nbTimeSpent=1;
}
else dol_print_error($db);

$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
$head[$h][1] = $langs->trans("TimeSpent");
if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>';
$head[$h][2] = 'timespent';
$h++;
}

// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
{
Expand Down Expand Up @@ -1205,7 +1205,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
{
continue;
}

// Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{
Expand Down
7 changes: 6 additions & 1 deletion htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -468,6 +468,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;

//var_dump($tabMenu);

$newmenu = $menu;

$mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]);
Expand Down Expand Up @@ -523,7 +525,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
* We update newmenu with entries found into database
* --------------------------------------------------
*/
if ($mainmenu)
if ($mainmenu) // If this is empty, loading hard coded menu and loading personalised menu will fail
{
/*
* Menu HOME
Expand Down Expand Up @@ -1628,6 +1630,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
}

//var_dump($tabMenu); //
//var_dump($newmenu->liste);

// Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
//var_dump($menu_array_before);exit;
//var_dump($menu_array_after);exit;
Expand Down

0 comments on commit 434cf2e

Please sign in to comment.