Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
Darkjeff 2017-06-27 12:45:56 +02:00
commit cb0e7b200e
13 changed files with 251 additions and 65 deletions

View File

@ -165,7 +165,7 @@ if ($action == 'edit')
$var=true; $var=true;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach($modules as $module => $delays) foreach($modules as $module => $delays)
{ {
@ -178,7 +178,7 @@ if ($action == 'edit')
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('',$delay['img']).'</td>'; print '<td width="20px">'.img_object('',$delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
print '<input size="5" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>'; print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
} }
} }
} }
@ -189,11 +189,11 @@ if ($action == 'edit')
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=false; $var=false;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
print '</table>'; print '</table>';
@ -211,7 +211,7 @@ else
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=true; $var=true;
foreach($modules as $module => $delays) foreach($modules as $module => $delays)
@ -225,7 +225,7 @@ else
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('',$delay['img']).'</td>'; print '<td width="20px">'.img_object('',$delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td>'.$value.' '.$langs->trans("days").'</td></tr>'; print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
} }
} }
} }
@ -236,11 +236,11 @@ else
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=false; $var=false;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
print '</table>'; print '</table>';

View File

@ -88,6 +88,7 @@ if (!empty($ExecTimeLimit))
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err); error_reporting($err);
} }
$MemoryLimit=0;
if (!empty($MemoryLimit)) if (!empty($MemoryLimit))
{ {
@ini_set('memory_limit', $MemoryLimit); @ini_set('memory_limit', $MemoryLimit);

View File

@ -40,7 +40,26 @@ function printBookmarksList($aDb, $aLangs)
$langs->load("bookmarks"); $langs->load("bookmarks");
$url= $_SERVER["PHP_SELF"].(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''); $url= $_SERVER["PHP_SELF"];
if (! empty($_SERVER["QUERY_STRING"]))
{
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
}
else
{
global $sortfield,$sortorder;
$tmpurl='';
// No urlencode, all param $url will be urlencoded later
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
foreach($_POST as $key => $val)
{
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
}
$url.=($tmpurl?'?'.$tmpurl:'');
}
$ret = ''; $ret = '';
@ -55,7 +74,8 @@ function printBookmarksList($aDb, $aLangs)
// Url to go on create new bookmark page // Url to go on create new bookmark page
if ($user->rights->bookmark->creer) if ($user->rights->bookmark->creer)
{ {
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url); //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($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 // Menu with all bookmarks

View File

@ -39,6 +39,7 @@ $id=GETPOST("id");
$action=GETPOST("action","alpha"); $action=GETPOST("action","alpha");
$title=GETPOST("title","alpha"); $title=GETPOST("title","alpha");
$url=GETPOST("url","alpha"); $url=GETPOST("url","alpha");
$urlsource=GETPOST("urlsource","alpha");
$target=GETPOST("target","alpha"); $target=GETPOST("target","alpha");
$userid=GETPOST("userid","int"); $userid=GETPOST("userid","int");
$position=GETPOST("position","int"); $position=GETPOST("position","int");
@ -64,7 +65,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
if (GETPOST("cancel")) if (GETPOST("cancel"))
{ {
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php')); if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
@ -97,7 +98,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
if ($res > 0) if ($res > 0)
{ {
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):DOL_URL_ROOT.'/bookmarks/list.php'); if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
@ -121,6 +122,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
} }
} }
/* /*
* View * View
*/ */
@ -153,7 +155,7 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("NewBookmark")); print load_fiche_titre($langs->trans("NewBookmark"));
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), 0, 'bookmark');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -161,7 +163,7 @@ if ($action == 'create')
dol_set_focus('#titlebookmark'); dol_set_focus('#titlebookmark');
// Url // Url
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.dol_escape_htmltag($url).'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
// Target // Target
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>'; print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
@ -219,7 +221,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
} }
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), -1, 'bookmark');
$linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';

View File

@ -338,6 +338,17 @@ if ($resql)
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
print $nav; print $nav;
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
$link.= $langs->trans("NewAction");
$link.= '</a>';
}
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit); print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit);
$moreforfilter=''; $moreforfilter='';

View File

@ -506,6 +506,11 @@ function calendars_prepare_head($param)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewList");
$head[$h][2] = 'cardlist';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:''); $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
$head[$h][1] = $langs->trans("ViewDay"); $head[$h][1] = $langs->trans("ViewDay");
$head[$h][2] = 'cardday'; $head[$h][2] = 'cardday';
@ -535,10 +540,6 @@ function calendars_prepare_head($param)
$head[$h][2] = 'cardperuser'; $head[$h][2] = 'cardperuser';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewList");
$head[$h][2] = 'cardlist';
$h++;
$object=new stdClass(); $object=new stdClass();

View File

@ -434,6 +434,8 @@ function currency_name($code_iso, $withcode='', $outputlangs=null)
if (empty($outputlangs)) $outputlangs=$langs; if (empty($outputlangs)) $outputlangs=$langs;
$outputlangs->load("dict");
// If there is a translation, we can send immediatly the label // If there is a translation, we can send immediatly the label
if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso) if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso)
{ {

View File

@ -1068,10 +1068,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Show page nb only on iso languages (so default Helvetica font) // Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
{ {
$pdf->SetXY(-20,-$posy); $pdf->SetXY($dims['wk']-$dims['rm']-15, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); else $pdf->MultiCell(15, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
return $marginwithfooter; return $marginwithfooter;

View File

@ -81,10 +81,10 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$url = $shorturl = $tmp[0]; $url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); $param = (isset($tmp[1])?$tmp[1]:'');
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url']))
{ {
$param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu='; $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
} }
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url']))
{ {
@ -94,6 +94,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$url = dol_buildpath($url,1).($param?'?'.$param:''); $url = dol_buildpath($url,1).($param?'?'.$param:'');
//$shorturl = $shorturl.($param?'?'.$param:''); //$shorturl = $shorturl.($param?'?'.$param:'');
$shorturl = $url; $shorturl = $url;
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl); if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
} }
@ -126,7 +127,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
// Output menu entries // Output menu entries
foreach($menu->liste as $menkey => $menuval) foreach($menu->liste as $menkey => $menuval)
{ {
if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']); if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']); if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']);
} }
@ -300,6 +301,16 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print "<!-- End SearchForm -->\n"; print "<!-- End SearchForm -->\n";
} }
if (is_array($moredata) && ! empty($moredata['bookmarks']))
{
print "\n";
print "<!-- Begin Bookmarks -->\n";
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
print $moredata['bookmarks'];
print '</div>'."\n";
print "<!-- End Bookmarks -->\n";
}
// We update newmenu with entries found into database // We update newmenu with entries found into database
$menuArbo = new Menubase($db,'auguria'); $menuArbo = new Menubase($db,'auguria');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu); $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
@ -563,16 +574,6 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block
} }
if (is_array($moredata) && ! empty($moredata['bookmarks']))
{
print "\n";
print "<!-- Begin Bookmarks -->\n";
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
print $moredata['bookmarks'];
print '</div>'."\n";
print "<!-- End Bookmarks -->\n";
}
return count($menu_array); return count($menu_array);
} }

View File

@ -1583,7 +1583,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$url = $shorturl = $tmp[0]; $url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link $param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
{ {
$param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; $param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';

View File

@ -235,7 +235,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>102, 'position'=>140,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -247,7 +247,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>103, 'position'=>141,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -259,7 +259,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>104, 'position'=>142,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -271,7 +271,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>105, 'position'=>143,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -283,7 +283,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>106, 'position'=>144,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -296,7 +296,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>112, 'position'=>110,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -308,7 +308,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>113, 'position'=>111,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>114, 'position'=>112,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -332,7 +332,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>115, 'position'=>113,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -344,7 +344,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>116, 'position'=>114,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -357,7 +357,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&amp;leftmenu=agenda', 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&amp;leftmenu=agenda',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>120, 'position'=>160,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',

View File

@ -271,3 +271,8 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10
ALTER TABLE llx_events MODIFY COLUMN ip varchar(250); ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);
UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur';
UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client';

View File

@ -0,0 +1,143 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file test/phpunit/CompanyLibTest.php
* \ingroup test
* \brief PHPUnit test
* \remarks To run this script as CLI: phpunit filename.php
*/
global $conf,$user,$langs,$db;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/company.lib.php';
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
/**
* Class for PHPUnit tests
*
* @backupGlobals disabled
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class CompanyLibTest extends PHPUnit_Framework_TestCase
{
protected $savconf;
protected $savuser;
protected $savlangs;
protected $savdb;
/**
* Constructor
* We save global variables into local variables
*
* @return AdminLibTest
*/
function __construct()
{
//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
$this->savlangs=$langs;
$this->savdb=$db;
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
//print " - db ".$db->db;
print "\n";
}
// Static methods
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
$db->rollback();
print __METHOD__."\n";
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__."\n";
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
{
print __METHOD__."\n";
}
/**
* testNameCurrency
*
* @return void
*/
public function testNameCurrency()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$result=currency_name('USD');
print __METHOD__." result=".$result."\n";
$this->assertEquals('US Dollars',$result,'Test to get currency name USD in default language '.$langs->defaultlang);
$outputlangs=new Translate('', $conf);
$outputlangs->setDefaultLang('fr_FR');
$result=currency_name('USD', 1, $outputlangs);
print __METHOD__." result=".$result."\n";
$this->assertEquals('USD - Dollars US',$result,'Test to get currency name USD in default language '.$outputlangs->getDefaultLang());
return $result;
}
}