Skip to content

Commit

Permalink
Merge remote-tracking branch 'uptream/develop' into 6.0-multijournal
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed May 7, 2017
2 parents 7c4b47f + 46ff62f commit dd97bbd
Show file tree
Hide file tree
Showing 45 changed files with 272 additions and 133 deletions.
22 changes: 22 additions & 0 deletions htdocs/admin/defaultvalues.php
Expand Up @@ -84,6 +84,11 @@
$search_array_options=array();
}

if ($action == 'setMAIN_ENABLE_DEFAULT_VALUES')
{
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
}

if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('actionmodify'))
{
Expand Down Expand Up @@ -185,6 +190,23 @@
print $langs->trans("DefaultValuesDesc")."<br>\n";
print "<br>\n";

print $langs->trans("EnableDefaultValues").' ';
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{
// Button off, click to enable
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&amp;value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>';
}
else
{
// Button on, click to disable
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&amp;value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a>';
}
print "<br><br>\n";

$param='&mode='.$mode;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
Expand Down
18 changes: 18 additions & 0 deletions htdocs/admin/modulehelp.php
Expand Up @@ -330,6 +330,24 @@
else $text.=$langs->trans("Disabled");
$text.='<br>';

$tmp = $objMod->getLastActivationInfo();
$authorid = $tmp['authorid'];
if ($authorid > 0)
{
$tmpuser = new User($db);
$tmpuser->fetch($authorid);
$text.='<strong>'.$langs->trans("LastActivationAuthor").':</strong> ';
$text.= $tmpuser->getNomUrl(1);
$text.='<br>';
}
$ip = $tmp['ip'];
if ($ip)
{
$text.='<strong>'.$langs->trans("LastActivationIP").':</strong> ';
$text.= $ip;
$text.='<br>';
}

$moduledesclong=$objMod->getDescLong();
if ($moduledesclong) $text.='<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
}
Expand Down
26 changes: 15 additions & 11 deletions htdocs/admin/modules.php
Expand Up @@ -402,9 +402,9 @@
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');

// Start to show page
if ($mode=='common') print $langs->trans("ModulesDesc")."<br>\n";
if ($mode=='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
if ($mode=='deploy') print $langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br>\n";
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";


$h = 0;
Expand Down Expand Up @@ -640,7 +640,8 @@
{
$disableSetup = 0;

print '<td class="center valignmiddle" width="80px">';
// Link enable/disabme
print '<td class="center valignmiddle" width="60px">';
if (! empty($arrayofwarnings[$modName]))
{
print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
Expand All @@ -662,12 +663,12 @@
}
print '</td>'."\n";

// Config link
// Link config
if (! empty($objMod->config_page_url) && !$disableSetup)
{
if (is_array($objMod->config_page_url))
{
print '<td class="tdsetuppicto right" width="40px"">';
print '<td class="tdsetuppicto right" width="60px">';
$i=0;
foreach ($objMod->config_page_url as $page)
{
Expand All @@ -693,22 +694,23 @@
}
else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
{
print '<td class="tdsetuppicto right valignmiddle" width="80px"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
}
else
{
print '<td class="tdsetuppicto right valignmiddle" width="80px"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
}
}
else
{
print '<td class="tdsetuppicto right valignmiddle" width="80px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
}

}
else // Module not yet activated
{
print '<td class="center valignmiddle" width="80px">';
// Link enable/disable
print '<td class="center valignmiddle" width="60px">';
if (! empty($objMod->always_enabled))
{
// Should never happened
Expand Down Expand Up @@ -754,7 +756,9 @@
print "</a>\n";
}
print "</td>\n";
print '<td class="tdsetuppicto right valignmiddle" width="80px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';

// Link config
print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
}

print "</tr>\n";
Expand Down
3 changes: 2 additions & 1 deletion htdocs/admin/stock.php
Expand Up @@ -149,6 +149,7 @@
//if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
//{
print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
print '<br>';
//}

// Title rule for stock decrease
Expand Down Expand Up @@ -433,7 +434,7 @@


print '<br />';
if ($conf->global->MAIN_LEVEL_FEATURES >= 2)
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$var=false;
print '<table class="noborder" width="100%">';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/admin/user.php
Expand Up @@ -167,7 +167,7 @@

$head=user_admin_prepare_head();

dol_fiche_head($head,'card', $langs->trans("MenuUsersAndGroups"), 0, 'user');
dol_fiche_head($head,'card', $langs->trans("MenuUsersAndGroups"), -1, 'user');

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
Expand Down Expand Up @@ -205,7 +205,7 @@

print '</table>';


print '<br>';

$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/usergroup.php
Expand Up @@ -151,7 +151,7 @@

$head=user_admin_prepare_head();

dol_fiche_head($head,'usergroupcard', $langs->trans("MenuUsersAndGroups"), 0, 'user');
dol_fiche_head($head,'usergroupcard', $langs->trans("MenuUsersAndGroups"), -1, 'user');


$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
Expand Down
21 changes: 16 additions & 5 deletions htdocs/bookmarks/bookmarks.lib.php
Expand Up @@ -62,14 +62,15 @@ function printBookmarksList($aDb, $aLangs)
*/
$ret.= '<div class="menu_top"></div>'."\n";

$ret.= '<!-- form with GET method --><form id="actionbookmark" name="actionbookmark" method="GET" action="">';
$ret.= '<!-- form with POST method by default --><form id="actionbookmark" name="actionbookmark" method="POST" action="">';
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo">';
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_js(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
// Url to go on create new bookmark page
if ($user->rights->bookmark->creer)
{
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_js($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
}
// Menu with all bookmarks
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
Expand All @@ -84,7 +85,7 @@ function printBookmarksList($aDb, $aLangs)
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
{
//$ret.='<div class="menu_contenu">';
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_js($obj->url).'">'.img_picto('','object_bookmark').' '.$obj->title.'</option>';
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">'.img_picto('','object_bookmark').' '.$obj->title.'</option>';
/*$ret.='<a class="vsmenu" title="'.$obj->title.'" href="'.$obj->url.'"'.($obj->target == 1?' target="_blank"':'').'>';
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $ret.=' '.img_object('','bookmark').' ';
$ret.= dol_trunc($obj->title, 20).'</a><br>';*/
Expand All @@ -109,9 +110,19 @@ function printBookmarksList($aDb, $aLangs)
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
if (! urltarget) { urltarget=""; }
console.log("We change select bookmark. We choose "+urlselected+" with target "+urltarget);
jQuery("form#actionbookmark").attr("target",urltarget);
jQuery("form#actionbookmark").attr("action",urlselected);
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
// Method is POST for internal link, GET for external
if (urlselected.startsWith(\'http\'))
{
var newmethod=\'GET\';
jQuery("form#actionbookmark").attr("method",newmethod);
console.log("We change method to newmethod="+newmethod);
}
jQuery("#actionbookmark").submit();
});';
$ret.='})</script>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/mailing/card.php
Expand Up @@ -1057,7 +1057,7 @@
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');

dol_fiche_head('');
dol_fiche_head('', '', '', -1);

print '<table class="border" width="100%">';

Expand Down
34 changes: 21 additions & 13 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -4938,25 +4938,33 @@ public function fetchCommon($id, $ref = null)

if(!empty($id)) $sql.= ' WHERE rowid = '.$id;
else $sql.= ' WHERE ref = \''.$this->quote($ref).'\'';

$res = $this->db->query($sql);
if($obj = $this->db->fetch_object($res))
if ($res)
{
$this->id = $id;
$this->set_vars_by_db($obj);

$this->datec = $this->db->idate($obj->datec);
$this->tms = $this->db->idate($obj->tms);

return $this->id;
if ($obj = $this->db->fetch_object($res))
{
$this->id = $id;
$this->set_vars_by_db($obj);

$this->datec = $this->db->idate($obj->datec);
$this->tms = $this->db->idate($obj->tms);

return $this->id;
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}

}

/**
Expand Down
2 changes: 0 additions & 2 deletions htdocs/core/class/coreobject.class.php
Expand Up @@ -106,14 +106,12 @@ private function checkFieldType($field, $type)
*/
public function fetch($id, $loadChild = true)
{

$res = $this->fetchCommon($id);
if($res>0) {
if ($loadChild) $this->fetchChild();
}

return $res;

}


Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/admin.lib.php
Expand Up @@ -812,7 +812,7 @@ function activateModule($value,$withdeps=1)
return $ret;
}

$result=$objMod->init();
$result=$objMod->init(); // Enable module
if ($result <= 0)
{
$ret['errors'][]=$objMod->error;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Expand Up @@ -260,7 +260,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
global $conf;

// Management of default values
if (! isset($_GET['sortfield']) && empty($conf->global->MAIN_DISABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_DISABLE_DEFAULT_VALUES is on
if (! isset($_GET['sortfield']) && ! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_DISABLE_DEFAULT_VALUES is on
{
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
Expand Down
29 changes: 23 additions & 6 deletions htdocs/core/lib/usergroups.lib.php
Expand Up @@ -59,6 +59,11 @@ function user_prepare_head($object)
$h++;
}

$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserGUISetup");
$head[$h][2] = 'guisetup';
$h++;

if ($canreadperms)
{
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
Expand All @@ -67,15 +72,27 @@ function user_prepare_head($object)
$h++;
}

$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserGUISetup");
$head[$h][2] = 'guisetup';
$h++;

if (! empty($conf->agenda->enabled))
{
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;

$i=1;
$nbagenda = 0;
while ($i <= $MAXAGENDA)
{
$key=$i;
$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
$i++;

if (! empty($object->conf->$name)) $nbagenda++;
}

$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
$head[$h][1] = $langs->trans("ExtSites");
$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
$head[$h][2] = 'extsites';
$h++;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/menus/standard/auguria.lib.php
Expand Up @@ -269,7 +269,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<div class="center"><img title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 80%"></div>'."\n";
print '<div class="center"><img title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 70%"></div>'."\n";
print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n";
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -478,7 +478,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<div class="center"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 80%"></div>'."\n";
print '<div class="center"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 70%"></div>'."\n";
print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n";
Expand Down Expand Up @@ -1265,7 +1265,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}

// Inventory
if ($conf->global->MAIN_LEVEL_FEATURES >= 2)
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
if (! empty($conf->stock->enabled))
{
Expand Down

0 comments on commit dd97bbd

Please sign in to comment.