Merge remote-tracking branch 'origin/3.8' into develop
Conflicts: htdocs/core/lib/memory.lib.php
This commit is contained in:
commit
24f7100562
@ -69,8 +69,9 @@ if ($db->type != 'mysql' && $db->type != 'mysqli')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show parameters
|
// Show parameters
|
||||||
print 'Tablename='.$argv[1]."\n";
|
print 'Tablename: '.$argv[1]."\n";
|
||||||
print "Current dir is ".getcwd()."\n";
|
print "Current dir: ".getcwd()."\n";
|
||||||
|
print "Database name: ".$db->database_name."\n";
|
||||||
|
|
||||||
|
|
||||||
// Define array with list of properties
|
// Define array with list of properties
|
||||||
@ -304,10 +305,9 @@ foreach($property as $key => $prop)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$varprop.=' \'.(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
$varprop.='\'.(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||||
$varprop.="\$this->".$prop['field']."";
|
$varprop.="\$this->".$prop['field']."";
|
||||||
$varprop.='.\').';
|
$varprop.='"\'")';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i < (count($property)-$no_output_field)) $varprop.=".','";
|
if ($i < (count($property)-$no_output_field)) $varprop.=".','";
|
||||||
|
|||||||
@ -193,7 +193,7 @@ class modMyModule extends DolibarrModules
|
|||||||
// Add here entries to declare new menus
|
// Add here entries to declare new menus
|
||||||
//
|
//
|
||||||
// Example to declare a new Top Menu entry and its Left menu entry:
|
// Example to declare a new Top Menu entry and its Left menu entry:
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
// $this->menu[$r]=array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
// 'type'=>'top', // This is a Top menu entry
|
// 'type'=>'top', // This is a Top menu entry
|
||||||
// 'titre'=>'MyModule top menu',
|
// 'titre'=>'MyModule top menu',
|
||||||
// 'mainmenu'=>'mymodule',
|
// 'mainmenu'=>'mymodule',
|
||||||
@ -208,7 +208,7 @@ class modMyModule extends DolibarrModules
|
|||||||
// $r++;
|
// $r++;
|
||||||
//
|
//
|
||||||
// Example to declare a Left Menu entry into an existing Top menu entry:
|
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
// 'type'=>'left', // This is a Left menu entry
|
// 'type'=>'left', // This is a Left menu entry
|
||||||
// 'titre'=>'MyModule left menu',
|
// 'titre'=>'MyModule left menu',
|
||||||
// 'mainmenu'=>'xxx',
|
// 'mainmenu'=>'xxx',
|
||||||
|
|||||||
@ -38,11 +38,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
|||||||
*/
|
*/
|
||||||
class Skeleton_Class extends CommonObject
|
class Skeleton_Class extends CommonObject
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var DoliDb Database handler
|
|
||||||
*/
|
|
||||||
protected $db;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Error code (or message)
|
* @var string Error code (or message)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
|||||||
@ -43,7 +43,7 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
|
|||||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||||
if (! $res) die("Include of main fails");
|
if (! $res) die("Include of main fails");
|
||||||
// Change this following line to use the correct relative path from htdocs
|
// Change this following line to use the correct relative path from htdocs
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/formcompany.class.php');
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||||
dol_include_once('/module/class/skeleton_class.class.php');
|
dol_include_once('/module/class/skeleton_class.class.php');
|
||||||
|
|
||||||
// Load traductions files requiredby by page
|
// Load traductions files requiredby by page
|
||||||
@ -62,7 +62,7 @@ if ($user->societe_id > 0)
|
|||||||
//accessforbidden();
|
//accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($action) && empty($id) && empty($ref)) $action='create';
|
if (empty($action) && empty($id) && empty($ref)) $action='list';
|
||||||
|
|
||||||
// Load object if id or ref is provided as parameter
|
// Load object if id or ref is provided as parameter
|
||||||
$object=new Skeleton_Class($db);
|
$object=new Skeleton_Class($db);
|
||||||
@ -225,7 +225,7 @@ jQuery(document).ready(function() {
|
|||||||
|
|
||||||
|
|
||||||
// Part to show a list
|
// Part to show a list
|
||||||
if ($action == 'list' || empty($id))
|
if ($action == 'list' || (empty($id) && $action != 'create'))
|
||||||
{
|
{
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
@ -243,7 +243,7 @@ if ($action == 'list' || empty($id))
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " ORDER BY field1 ASC";
|
$sql.=$db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ if ($action == 'list' || empty($id))
|
|||||||
// Part to create
|
// Part to create
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("NewResidence"));
|
print_fiche_titre($langs->trans("NewSkeleton"));
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|||||||
@ -646,7 +646,7 @@ else
|
|||||||
print '<td colspan="2"><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
|
print '<td colspan="2"><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
|
||||||
if ($object->birthday_alert)
|
if ($object->birthday_alert)
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" name="birthday_alert" id="birthday_aler" checked></td>';
|
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked></td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,6 +53,11 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public $error;
|
public $error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[] Array of error strings
|
||||||
|
*/
|
||||||
|
public $errors=array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Key value used to track if data is coming from import wizard
|
* @var string Key value used to track if data is coming from import wizard
|
||||||
*/
|
*/
|
||||||
@ -82,11 +87,6 @@ abstract class CommonObject
|
|||||||
|
|
||||||
// Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.
|
// Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string[] Array of error strings
|
|
||||||
*/
|
|
||||||
public $errors=array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] Can be used to pass information when only object is provided to method
|
* @var string[] Can be used to pass information when only object is provided to method
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2766,7 +2766,7 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi
|
|||||||
* @param int $id To force an id on html objects
|
* @param int $id To force an id on html objects
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id=0)
|
function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -47,20 +47,19 @@ function dol_setcache($memoryid,$data)
|
|||||||
// Using a memcached server
|
// Using a memcached server
|
||||||
if (! empty($conf->memcached->enabled) && class_exists('Memcached'))
|
if (! empty($conf->memcached->enabled) && class_exists('Memcached'))
|
||||||
{
|
{
|
||||||
global $m;
|
global $dolmemcache;
|
||||||
if (empty($m) || ! is_object($m))
|
if (empty($dolmemcache) || ! is_object($dolmemcache))
|
||||||
{
|
{
|
||||||
$m=new Memcached();
|
$dolmemcache=new Memcached();
|
||||||
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
|
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
|
||||||
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
||||||
if (! $result) return -1;
|
if (! $result) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$memoryid=session_name().'_'.$memoryid;
|
$memoryid=session_name().'_'.$memoryid;
|
||||||
//$m->setOption(Memcached::OPT_COMPRESSION, false);
|
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
|
||||||
//print "Add memoryid=".$memoryid;
|
$dolmemcache->add($memoryid,$data); // This fails if key already exists
|
||||||
$m->add($memoryid,$data); // This fails if key already exists
|
$rescode=$dolmemcache->getResultCode();
|
||||||
$rescode=$m->getResultCode();
|
|
||||||
if ($rescode == 0)
|
if ($rescode == 0)
|
||||||
{
|
{
|
||||||
return count($data);
|
return count($data);
|
||||||
@ -72,18 +71,18 @@ function dol_setcache($memoryid,$data)
|
|||||||
}
|
}
|
||||||
else if (! empty($conf->memcached->enabled) && class_exists('Memcache'))
|
else if (! empty($conf->memcached->enabled) && class_exists('Memcache'))
|
||||||
{
|
{
|
||||||
global $m;
|
global $dolmemcache;
|
||||||
if (empty($m) || ! is_object($m))
|
if (empty($dolmemcache) || ! is_object($dolmemcache))
|
||||||
{
|
{
|
||||||
$m=new Memcache();
|
$dolmemcache=new Memcache();
|
||||||
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
|
$tmparray=explode(':',$conf->global->MEMCACHED_SERVER);
|
||||||
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
||||||
if (! $result) return -1;
|
if (! $result) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$memoryid=session_name().'_'.$memoryid;
|
$memoryid=session_name().'_'.$memoryid;
|
||||||
//$m->setOption(Memcached::OPT_COMPRESSION, false);
|
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
|
||||||
$result=$m->add($memoryid,$data); // This fails if key already exists
|
$result=$dolmemcache->add($memoryid,$data); // This fails if key already exists
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
return count($data);
|
return count($data);
|
||||||
|
|||||||
@ -248,7 +248,7 @@ if (!$object->fk_user_creat) {
|
|||||||
print '<tr><td>'.$langs->trans('ToReceiveEMailForEachVote').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('ToReceiveEMailForEachVote').'</td><td colspan="2">';
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" name="mailsonde" size="40"'.($object->mailsonde?' checked':'').'">';
|
print '<input type="checkbox" name="mailsonde" '.($object->mailsonde?'checked="checked"':'').'">';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print yn($object->mailsonde);
|
print yn($object->mailsonde);
|
||||||
@ -266,7 +266,7 @@ print '</td></tr>';
|
|||||||
print '<tr><td>'.$langs->trans('CanComment').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('CanComment').'</td><td colspan="2">';
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" name="cancomment" size="40"'.($object->allow_comments?' checked':'').'">';
|
print '<input type="checkbox" name="cancomment" '.($object->allow_comments?'checked="checked"':'').'">';
|
||||||
}
|
}
|
||||||
else print yn($object->allow_comments);
|
else print yn($object->allow_comments);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -275,7 +275,7 @@ print '</td></tr>';
|
|||||||
print '<tr><td>'.$langs->trans('CanSeeOthersVote').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('CanSeeOthersVote').'</td><td colspan="2">';
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" name="canseeothersvote" size="40"'.($object->allow_spy?' checked':'').'">';
|
print '<input type="checkbox" name="canseeothersvote" '.($object->allow_spy?'checked="checked"':'').'">';
|
||||||
}
|
}
|
||||||
else print yn($object->allow_spy);
|
else print yn($object->allow_spy);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user