New: We can use a dynamic value ($conf->global->XXX for example) into
titles of menus. New: Can choose menu entry to show with external site module.
This commit is contained in:
parent
542b6f0731
commit
8896803921
@ -57,6 +57,7 @@ For users:
|
|||||||
- New: Added ODT Template tag {object_total_discount}
|
- New: Added ODT Template tag {object_total_discount}
|
||||||
- New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices
|
- New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices
|
||||||
- New: English bank account need a bank code (called sort code) to identify an account.
|
- New: English bank account need a bank code (called sort code) to identify an account.
|
||||||
|
- New: Can choose menu entry to show with external site module.
|
||||||
- New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM
|
- New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM
|
||||||
to force margins of generated PDF.
|
to force margins of generated PDF.
|
||||||
New experimental modules:
|
New experimental modules:
|
||||||
@ -87,6 +88,7 @@ For developers:
|
|||||||
- New: Add ChromePHP output into syslog module.
|
- New: Add ChromePHP output into syslog module.
|
||||||
- New: Add PRODUCT_PRICE_MODIFY trigger.
|
- New: Add PRODUCT_PRICE_MODIFY trigger.
|
||||||
- New: Created function to retrieve total amount of discount of an invoice/proposal...
|
- New: Created function to retrieve total amount of discount of an invoice/proposal...
|
||||||
|
- New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus.
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- New: Update language files (de, tr, pt, ca, es, en, fr).
|
- New: Update language files (de, tr, pt, ca, es, en, fr).
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class Translate
|
|||||||
* @param string $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES)
|
* @param string $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES)
|
||||||
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
|
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
|
||||||
* @param int $forcelangdir To force a different lang directory
|
* @param int $forcelangdir To force a different lang directory
|
||||||
* @return int <0 if KO, 0 if already loaded, >0 if OK
|
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
||||||
*/
|
*/
|
||||||
function Load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='')
|
function Load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='')
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ class Translate
|
|||||||
dol_print_error('',get_class($this)."::Load ErrorWrongParameters");
|
dol_print_error('',get_class($this)."::Load ErrorWrongParameters");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if ($this->defaultlang == 'none_NONE') return; // Special language code to not translate keys
|
if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys
|
||||||
|
|
||||||
//dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
|
//dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ class Translate
|
|||||||
{
|
{
|
||||||
$str=$this->tab_translate[$key];
|
$str=$this->tab_translate[$key];
|
||||||
|
|
||||||
// Overwrite translation
|
// Overwrite translation (TODO Move this at a higher level when we load tab_translate to avoid doing it for each trans call)
|
||||||
$overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
|
$overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
|
||||||
if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2
|
if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2
|
||||||
{
|
{
|
||||||
@ -399,7 +399,7 @@ class Translate
|
|||||||
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
|
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
|
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
|
||||||
|
|
||||||
if ($maxsize) $str=dol_trunc($str,$maxsize);
|
if ($maxsize) $str=dol_trunc($str,$maxsize);
|
||||||
@ -417,8 +417,7 @@ class Translate
|
|||||||
}
|
}
|
||||||
else // Translation is not available
|
else // Translation is not available
|
||||||
{
|
{
|
||||||
//$str=$this->getTradFromKey($key);
|
if ($key[0] == '$') { return dol_eval($key,1); }
|
||||||
//return $this->convToOutputCharset($str);
|
|
||||||
return $this->getTradFromKey($key);
|
return $this->getTradFromKey($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,7 +459,7 @@ class Translate
|
|||||||
function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='')
|
function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (! empty($this->tab_translate[$key])) // Translation is available
|
if (! empty($this->tab_translate[$key])) // Translation is available
|
||||||
{
|
{
|
||||||
$str=$this->tab_translate[$key];
|
$str=$this->tab_translate[$key];
|
||||||
@ -476,14 +475,16 @@ class Translate
|
|||||||
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
|
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
|
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
|
||||||
|
|
||||||
|
return $str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$str=$this->getTradFromKey($key);
|
if ($key[0] == '$') { return dol_eval($key,1); }
|
||||||
|
return $this->getTradFromKey($key);
|
||||||
}
|
}
|
||||||
return $str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3874,12 +3874,13 @@ function verifCond($strRights)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace eval function to add more security.
|
* Replace eval function to add more security.
|
||||||
* This function is called by verifCond()
|
* This function is called by verifCond() or trans() and transnoentitiesnoconv().
|
||||||
*
|
*
|
||||||
* @param string $s String to evaluate
|
* @param string $s String to evaluate
|
||||||
* @return mixed Result of eval
|
* @param int $returnvalue 0=No return (used to execute $a=something). 1=Value of eval is returned (used to eval $something).
|
||||||
|
* @return mixed Nothing or return of eval
|
||||||
*/
|
*/
|
||||||
function dol_eval($s)
|
function dol_eval($s,$returnvalue=0)
|
||||||
{
|
{
|
||||||
// Only global variables can be changed by eval function and returned to caller
|
// Only global variables can be changed by eval function and returned to caller
|
||||||
global $langs, $user, $conf;
|
global $langs, $user, $conf;
|
||||||
@ -3887,7 +3888,8 @@ function dol_eval($s)
|
|||||||
global $rights;
|
global $rights;
|
||||||
|
|
||||||
//print $s."<br>\n";
|
//print $s."<br>\n";
|
||||||
eval($s);
|
if ($returnvalue) return eval('return '.$s.';');
|
||||||
|
else eval($s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -53,7 +53,7 @@ class modExternalSite extends DolibarrModules
|
|||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||||
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
|
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
|
||||||
$this->description = "Include any external web site into Dolibarr menus and view it into a Dolibarr frame.";
|
$this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame.";
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
$this->version = 'dolibarr';
|
$this->version = 'dolibarr';
|
||||||
// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
|
// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
|
||||||
@ -63,7 +63,7 @@ class modExternalSite extends DolibarrModules
|
|||||||
// Name of png file (without png) used for this module
|
// Name of png file (without png) used for this module
|
||||||
$this->picto='bookmark';
|
$this->picto='bookmark';
|
||||||
// Call to inside lang's file
|
// Call to inside lang's file
|
||||||
$this->langfiles = array("@externalsite");
|
$this->langfiles = array("externalsite");
|
||||||
|
|
||||||
// Data directories to create when module is enabled
|
// Data directories to create when module is enabled
|
||||||
$this->dirs = array();
|
$this->dirs = array();
|
||||||
@ -76,7 +76,11 @@ class modExternalSite extends DolibarrModules
|
|||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array(); // List of parameters
|
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||||
|
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
|
||||||
|
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
|
||||||
|
// );
|
||||||
|
$this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0));
|
||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array(); // List of boxes
|
$this->boxes = array(); // List of boxes
|
||||||
@ -97,18 +101,19 @@ class modExternalSite extends DolibarrModules
|
|||||||
//------
|
//------
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
$this->menu[$r]=array('fk_menu'=>0,
|
$this->menu[$r]=array(
|
||||||
'type'=>'top',
|
'fk_menu'=>0,
|
||||||
'titre'=>'ExternalSites',
|
'type'=>'top',
|
||||||
'mainmenu'=>'externalsite',
|
'titre'=>'$conf->global->EXTERNALSITE_LABEL',
|
||||||
'url'=>'/externalsite/frames.php',
|
'mainmenu'=>'externalsite',
|
||||||
'langs'=>'other',
|
'url'=>'/externalsite/frames.php',
|
||||||
'position'=>100,
|
'langs'=>'other',
|
||||||
'perms'=>'',
|
'position'=>100,
|
||||||
'enabled'=>'$conf->externalsite->enabled',
|
'perms'=>'',
|
||||||
'target'=>'',
|
'enabled'=>'$conf->externalsite->enabled',
|
||||||
'user'=>0
|
'target'=>'',
|
||||||
);
|
'user'=>0
|
||||||
|
);
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,13 +48,15 @@ if ($action == 'update')
|
|||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
$label = GETPOST('EXTERNALSITE_LABEL','alpha');
|
||||||
$exturl = GETPOST('EXTERNALSITE_URL','alpha');
|
$exturl = GETPOST('EXTERNALSITE_URL','alpha');
|
||||||
|
|
||||||
|
$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
|
||||||
$i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
|
$i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
|
||||||
//$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($_POST["EXTERNALSITE_LABEL"]),'chaine',0,'',$conf->entity);
|
//$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($_POST["EXTERNALSITE_LABEL"]),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if ($i >= 1)
|
if ($i >= 2)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||||
@ -75,8 +77,9 @@ llxHeader();
|
|||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print_fiche_titre($langs->trans("ExternalSiteSetup"),$linkback,'setup');
|
print_fiche_titre($langs->trans("ExternalSiteSetup"),$linkback,'setup');
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
print $langs->trans("Module100Desc")."<br>\n";
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '<form name="externalsiteconfig" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form name="externalsiteconfig" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -89,17 +92,21 @@ print "<td>".$langs->trans("Value")."</td>";
|
|||||||
print "<td>".$langs->trans("Examples")."</td>";
|
print "<td>".$langs->trans("Examples")."</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
/*print "<tr class=\"impair\">";
|
$var=true;
|
||||||
print "<td>".$langs->trans("Label")."</td>";
|
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_LABEL\" value=\"". ($_POST["EXTERNALSITE_LABEL"]?$_POST["EXTERNALSITE_LABEL"]:$conf->global->EXTERNALSITE_LABEL) . "\" size=\"40\"></td>";
|
$var=!$var;
|
||||||
print "<td>My menu";
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td class="fieldrequired">'.$langs->trans("Label")."</td>";
|
||||||
|
print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_LABEL\" value=\"". (GETPOST('EXTERNALSITE_LABEL','alpha')?GETPOST('EXTERNALSITE_LABEL','alpha'):((empty($conf->global->EXTERNALSITE_LABEL) || $conf->global->EXTERNALSITE_LABEL=='ExternalSite')?'':$conf->global->EXTERNALSITE_LABEL)) . "\" size=\"12\"></td>";
|
||||||
|
print "<td>http://localhost/myurl/";
|
||||||
|
print "<br>http://wikipedia.org/";
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
*/
|
|
||||||
|
|
||||||
print "<tr class=\"impair\">";
|
$var=!$var;
|
||||||
print "<td>".$langs->trans("ExternalSiteURL")."</td>";
|
print "<tr ".$bc[$var].">";
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_URL\" value=\"". (GETPOST('EXTERNALSITE_URL','alpha')?GETPOST('EXTERNALSITE_URL','alpha'):$conf->global->EXTERNALSITE_URL) . "\" size=\"40\"></td>";
|
print '<td class="fieldrequired">'.$langs->trans("ExternalSiteURL")."</td>";
|
||||||
|
print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_URL\" value=\"". (GETPOST('EXTERNALSITE_URL','alpha')?GETPOST('EXTERNALSITE_URL','alpha'):(empty($conf->global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL)) . "\" size=\"40\"></td>";
|
||||||
print "<td>http://localhost/myurl/";
|
print "<td>http://localhost/myurl/";
|
||||||
print "<br>http://wikipedia.org/";
|
print "<br>http://wikipedia.org/";
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -117,7 +124,8 @@ print "</form>\n";
|
|||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -400,7 +400,7 @@ Module80Desc=Shipments and delivery order management
|
|||||||
Module85Name=Banks and cash
|
Module85Name=Banks and cash
|
||||||
Module85Desc=Management of bank or cash accounts
|
Module85Desc=Management of bank or cash accounts
|
||||||
Module100Name=External site
|
Module100Name=External site
|
||||||
Module100Desc=Include any external web site into Dolibarr menus and view it into a Dolibarr frame
|
Module100Desc=This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame
|
||||||
Module105Name=Mailman and SPIP
|
Module105Name=Mailman and SPIP
|
||||||
Module105Desc=Mailman or SPIP interface for member module
|
Module105Desc=Mailman or SPIP interface for member module
|
||||||
Module200Name=LDAP
|
Module200Name=LDAP
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user