Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
b8c2c1a907
@ -215,20 +215,14 @@ if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
|||||||
{
|
{
|
||||||
// Button off, click to enable
|
// Button off, click to enable
|
||||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
|
||||||
//$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
|
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation");
|
|
||||||
$enabledisablehtml.='</span>';
|
|
||||||
$enabledisablehtml.='</a>';
|
$enabledisablehtml.='</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Button on, click to disable
|
// Button on, click to disable
|
||||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
|
||||||
//$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
|
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation");
|
|
||||||
$enabledisablehtml.='</span>';
|
|
||||||
$enabledisablehtml.='</a>';
|
$enabledisablehtml.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/admin/websites.php
|
* \file htdocs/admin/website.php
|
||||||
* \ingroup setup
|
* \ingroup setup
|
||||||
* \brief Page to administer web sites
|
* \brief Page to administer web sites
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@ -99,11 +99,11 @@ $tabrowid[1] = "";
|
|||||||
|
|
||||||
// Condition to show dictionary in setup page
|
// Condition to show dictionary in setup page
|
||||||
$tabcond=array();
|
$tabcond=array();
|
||||||
$tabcond[1] = (! empty($conf->websites->enabled));
|
$tabcond[1] = (! empty($conf->website->enabled));
|
||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>'));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -205,7 +205,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
|||||||
if ($result) // Add is ok
|
if ($result) // Add is ok
|
||||||
{
|
{
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
|
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey;
|
||||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||||
$filecss=$pathofwebsite.'/styles.css.php';
|
$filecss=$pathofwebsite.'/styles.css.php';
|
||||||
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||||
@ -283,8 +283,8 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
|||||||
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
||||||
if ($newname != $website->ref)
|
if ($newname != $website->ref)
|
||||||
{
|
{
|
||||||
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
$srcfile=DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||||
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
$destfile=DOL_DATA_ROOT.'/website/'.$newname;
|
||||||
|
|
||||||
if (dol_is_dir($destfile))
|
if (dol_is_dir($destfile))
|
||||||
{
|
{
|
||||||
@ -206,7 +206,7 @@ if (count($object->records) > 0)
|
|||||||
if ($website)
|
if ($website)
|
||||||
{
|
{
|
||||||
$virtualurl='';
|
$virtualurl='';
|
||||||
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
|
$dataroot=DOL_DATA_ROOT.'/collab/'.$website;
|
||||||
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ if (count($object->records) > 0)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$urlext=$virtualurl;
|
$urlext=$virtualurl;
|
||||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
$urlint=$urlwithroot.'/public/collab/index.php?website='.$website;
|
||||||
//if (! empty($object->virtualhost))
|
//if (! empty($object->virtualhost))
|
||||||
//{
|
//{
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||||
@ -246,7 +246,7 @@ if (count($object->records) > 0)
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
//}
|
//}
|
||||||
|
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/collab/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ if (count($object->records) > 0)
|
|||||||
$websitepage = new WebSitePage($db);
|
$websitepage = new WebSitePage($db);
|
||||||
$websitepage->fetch($pageid);
|
$websitepage->fetch($pageid);
|
||||||
|
|
||||||
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
|
$realpage=$urlwithroot.'/public/collab/index.php?website='.$website.'&page='.$pageid;
|
||||||
$pagealias = $websitepage->pageurl;
|
$pagealias = $websitepage->pageurl;
|
||||||
|
|
||||||
print '<div class="websiteinputurl">';
|
print '<div class="websiteinputurl">';
|
||||||
|
|||||||
@ -340,6 +340,15 @@ abstract class CommonObject
|
|||||||
|
|
||||||
// No constructor as it is an abstract class
|
// No constructor as it is an abstract class
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if an object manage the multicompany field and how.
|
||||||
|
*
|
||||||
|
* @return int 0=No entity field managed, 1=Test with field entity, 2=Test with link to thirdparty (and sales representative)
|
||||||
|
*/
|
||||||
|
function getIsmultientitymanaged()
|
||||||
|
{
|
||||||
|
return $this->ismultientitymanaged;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check an object id/ref exists
|
* Check an object id/ref exists
|
||||||
@ -1338,16 +1347,16 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
||||||
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
||||||
if (! empty($filter))
|
if (! empty($filter))
|
||||||
{
|
{
|
||||||
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
||||||
$sql.=$filter;
|
$sql.=$filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
||||||
|
|
||||||
//print $filter.' '.$sql."<br>";
|
//print $filter.' '.$sql."<br>";
|
||||||
@ -1363,16 +1372,16 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
||||||
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
||||||
if (! empty($filter))
|
if (! empty($filter))
|
||||||
{
|
{
|
||||||
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
||||||
$sql.=$filter;
|
$sql.=$filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
||||||
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
|
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,6 @@ class EmailSenderProfile extends CommonObject
|
|||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element = 'c_email_senderprofile';
|
public $table_element = 'c_email_senderprofile';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array Does this field is linked to a thirdparty ?
|
|
||||||
*/
|
|
||||||
protected $isnolinkedbythird = 1;
|
|
||||||
/**
|
/**
|
||||||
* @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
* @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -48,7 +48,7 @@ $Config['Enabled'] = true ;
|
|||||||
$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access
|
$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access
|
||||||
|
|
||||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website)?'':'_'.$website).'&entity='.$extEntity.'&file=' ;
|
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website)?'':'_'.$website).'&entity='.$extEntity.'&file=' ;
|
||||||
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/' . $entity : '') . '/medias/') : ('/websites/'.$website));
|
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/' . $entity : '') . '/medias/') : ('/website/'.$website));
|
||||||
|
|
||||||
|
|
||||||
// Fill the following value it you prefer to specify the absolute path for the
|
// Fill the following value it you prefer to specify the absolute path for the
|
||||||
|
|||||||
@ -185,6 +185,34 @@ function societe_prepare_head(Societe $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->website->enabled) && (!empty($user->rights->societe->lire) ))
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("WebSites");
|
||||||
|
$nbNote = 0;
|
||||||
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as n";
|
||||||
|
$sql.= " WHERE fk_soc = ".$object->id;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbNote=$obj->nb;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
|
$head[$h][2] = 'website';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
|||||||
@ -2669,7 +2669,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
*/
|
*/
|
||||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0)
|
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $langs;
|
||||||
|
|
||||||
// Define fullpathpicto to use into src
|
// Define fullpathpicto to use into src
|
||||||
if ($pictoisfullpath)
|
if ($pictoisfullpath)
|
||||||
@ -2680,6 +2680,23 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($picto == 'switch_off')
|
||||||
|
{
|
||||||
|
$enabledisablehtml='';
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
|
return $enabledisablehtml;
|
||||||
|
}
|
||||||
|
if ($picto == 'switch_on')
|
||||||
|
{
|
||||||
|
$enabledisablehtml='';
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
|
return $enabledisablehtml;
|
||||||
|
}
|
||||||
|
|
||||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||||
$url = DOL_URL_ROOT;
|
$url = DOL_URL_ROOT;
|
||||||
$theme = $conf->theme;
|
$theme = $conf->theme;
|
||||||
|
|||||||
@ -254,6 +254,15 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
|||||||
$texttoinsert.= "\t".$key." ".$val['type'];
|
$texttoinsert.= "\t".$key." ".$val['type'];
|
||||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($val['default'] != '')
|
||||||
|
{
|
||||||
|
if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL";
|
||||||
|
else if (preg_match('/varchar/', $val['type'])) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'";
|
||||||
|
else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:'');
|
||||||
|
}
|
||||||
|
}
|
||||||
$texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':'');
|
$texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':'');
|
||||||
if ($i < count($object->fields)) $texttoinsert.=", ";
|
if ($i < count($object->fields)) $texttoinsert.=", ";
|
||||||
$texttoinsert.= "\n";
|
$texttoinsert.= "\n";
|
||||||
|
|||||||
@ -68,9 +68,9 @@ function dolWebsiteOutput($content)
|
|||||||
global $website;
|
global $website;
|
||||||
|
|
||||||
// Replace relative link / with dolibarr URL: ...href="/"...
|
// Replace relative link / with dolibarr URL: ...href="/"...
|
||||||
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||||
// Replace relative link /xxx.php with dolibarr URL: ...href="....php"
|
// Replace relative link /xxx.php with dolibarr URL: ...href="....php"
|
||||||
$content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
$content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||||
|
|
||||||
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||||
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||||
@ -101,9 +101,9 @@ function dolWebsiteReplacementOfLinks($website, $content)
|
|||||||
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $content);
|
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $content);
|
||||||
|
|
||||||
// Replace relative link / with dolibarr URL
|
// Replace relative link / with dolibarr URL
|
||||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||||
// Replace relative link /xxx.php with dolibarr URL
|
// Replace relative link /xxx.php with dolibarr URL
|
||||||
$content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
$content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||||
|
|
||||||
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||||
|
|
||||||
|
|||||||
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup websites Module websites
|
* \defgroup website Module website
|
||||||
* \brief Websites module descriptor.
|
* \brief website module descriptor.
|
||||||
* \file htdocs/core/modules/modWebsites.class.php
|
* \file htdocs/core/modules/modWebsite.class.php
|
||||||
* \ingroup websites
|
* \ingroup websites
|
||||||
* \brief Description and activation file for module Websites
|
* \brief Description and activation file for module Website
|
||||||
*/
|
*/
|
||||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
|||||||
/**
|
/**
|
||||||
* Class to describe Websites module
|
* Class to describe Websites module
|
||||||
*/
|
*/
|
||||||
class modWebsites extends DolibarrModules
|
class modWebsite extends DolibarrModules
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,11 +60,11 @@ class modWebsites extends DolibarrModules
|
|||||||
$this->picto='globe';
|
$this->picto='globe';
|
||||||
|
|
||||||
// Data directories to create when module is enabled
|
// Data directories to create when module is enabled
|
||||||
$this->dirs = array("/websites/temp");
|
$this->dirs = array("/website/temp");
|
||||||
|
|
||||||
// Config pages
|
// Config pages
|
||||||
//-------------
|
//-------------
|
||||||
$this->config_page_url = array('websites.php');
|
$this->config_page_url = array('website.php');
|
||||||
|
|
||||||
// Dependancies
|
// Dependancies
|
||||||
//-------------
|
//-------------
|
||||||
@ -80,7 +80,7 @@ class modWebsites extends DolibarrModules
|
|||||||
|
|
||||||
// New pages on tabs
|
// New pages on tabs
|
||||||
// -----------------
|
// -----------------
|
||||||
$this->tabs[] = array('data'=>'thirdparty:+websites:WebSites:website:$user->rights->websites->read:/societe/website.php?mainmenu=home&id=__ID__'); // To add a new tab identified by code tabname1
|
//$this->tabs[] = array('data'=>'thirdparty:+website:WebSites:website:($conf->societe->enabled && $user->rights->societe->lire):/societe/website.php?mainmenu=home&id=__ID__'); // To add a new tab identified by code tabname1
|
||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
//------
|
//------
|
||||||
@ -88,7 +88,7 @@ class modWebsites extends DolibarrModules
|
|||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array(); // Permission array used by this module
|
$this->rights = array(); // Permission array used by this module
|
||||||
$this->rights_class = 'websites';
|
$this->rights_class = 'website';
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
$this->rights[$r][0] = 10001;
|
$this->rights[$r][0] = 10001;
|
||||||
@ -114,12 +114,12 @@ class modWebsites extends DolibarrModules
|
|||||||
$this->menu[$r]=array( 'fk_menu'=>'0', // 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'=>'0', // 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 Left menu entry
|
'type'=>'top', // This is a Left menu entry
|
||||||
'titre'=>'Websites',
|
'titre'=>'Websites',
|
||||||
'mainmenu'=>'websites',
|
'mainmenu'=>'website',
|
||||||
'url'=>'/websites/index.php',
|
'url'=>'/website/index.php',
|
||||||
'langs'=>'websites', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>100,
|
'position'=>100,
|
||||||
'enabled'=>'$conf->websites->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
'perms'=>'$user->rights->websites->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
$r++;
|
$r++;
|
||||||
@ -130,7 +130,7 @@ class modWebsites extends DolibarrModules
|
|||||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||||
$this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
$this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
$this->export_icon[$r]='globe';
|
$this->export_icon[$r]='globe';
|
||||||
$keyforclass = 'WebsitePage'; $keyforclassfile='/websites/class/websitepage.class.php'; $keyforelement='Website';
|
$keyforclass = 'WebsitePage'; $keyforclassfile='/website/class/websitepage.class.php'; $keyforelement='Website';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||||
//$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra';
|
//$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra';
|
||||||
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
@ -23,6 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
$website=new Website($db);
|
$website=new Website($db);
|
||||||
$website->fetch(0,$websitekey);
|
$website->fetch(0,$websitekey);
|
||||||
|
|||||||
@ -34,7 +34,6 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
public $element='holiday';
|
public $element='holiday';
|
||||||
public $table_element='holiday';
|
public $table_element='holiday';
|
||||||
protected $isnolinkedbythird = 1; // No field fk_soc
|
|
||||||
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
public $picto = 'holiday';
|
public $picto = 'holiday';
|
||||||
|
|
||||||
|
|||||||
@ -168,6 +168,42 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN extraparams varchar(255);
|
|||||||
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_lim_reglement datetime;
|
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_lim_reglement datetime;
|
||||||
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN fk_user integer NULL;
|
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN fk_user integer NULL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE llx_websiteaccount(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||||
|
login varchar(64) NOT NULL,
|
||||||
|
label varchar(255),
|
||||||
|
note_public text,
|
||||||
|
note_private text,
|
||||||
|
date_creation datetime NOT NULL,
|
||||||
|
tms timestamp NOT NULL,
|
||||||
|
fk_user_creat integer NOT NULL,
|
||||||
|
fk_user_modif integer,
|
||||||
|
import_key varchar(14),
|
||||||
|
status integer,
|
||||||
|
fk_soc integer
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_import_key (import_key);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc);
|
||||||
|
|
||||||
|
create table llx_websiteaccount_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS llx_expensereport_ik (
|
CREATE TABLE IF NOT EXISTS llx_expensereport_ik (
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
datec datetime DEFAULT NULL,
|
datec datetime DEFAULT NULL,
|
||||||
@ -396,3 +432,7 @@ create table llx_c_email_senderprofile
|
|||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
ALTER TABLE llx_c_email_senderprofile ADD UNIQUE INDEX uk_c_email_senderprofile(entity, label, email);
|
ALTER TABLE llx_c_email_senderprofile ADD UNIQUE INDEX uk_c_email_senderprofile(entity, label, email);
|
||||||
|
|
||||||
|
|
||||||
|
-- May have error due to duplicate keys
|
||||||
|
ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
|
||||||
|
|||||||
@ -15,4 +15,6 @@
|
|||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
|
||||||
|
|
||||||
ALTER TABLE llx_resource ADD INDEX fk_code_type_resource_idx (fk_code_type_resource);
|
ALTER TABLE llx_resource ADD INDEX fk_code_type_resource_idx (fk_code_type_resource);
|
||||||
26
htdocs/install/mysql/tables/llx_websiteaccount.key.sql
Normal file
26
htdocs/install/mysql/tables/llx_websiteaccount.key.sql
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
-- Copyright (C) 2016 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/.
|
||||||
|
|
||||||
|
|
||||||
|
-- BEGIN MODULEBUILDER INDEXES
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_import_key (import_key);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status);
|
||||||
|
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc);
|
||||||
|
-- END MODULEBUILDER INDEXES
|
||||||
|
|
||||||
|
--ALTER TABLE llx_websiteaccount ADD CONSTRAINT llx_websiteaccount_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
|
||||||
|
|
||||||
32
htdocs/install/mysql/tables/llx_websiteaccount.sql
Normal file
32
htdocs/install/mysql/tables/llx_websiteaccount.sql
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
-- Copyright (C) 2016 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/.
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE llx_websiteaccount(
|
||||||
|
-- BEGIN MODULEBUILDER FIELDS
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||||
|
login varchar(64) NOT NULL,
|
||||||
|
label varchar(255),
|
||||||
|
note_public text,
|
||||||
|
note_private text,
|
||||||
|
date_creation datetime NOT NULL,
|
||||||
|
tms timestamp NOT NULL,
|
||||||
|
fk_user_creat integer NOT NULL,
|
||||||
|
fk_user_modif integer,
|
||||||
|
import_key varchar(14),
|
||||||
|
status integer,
|
||||||
|
fk_soc integer
|
||||||
|
-- END MODULEBUILDER FIELDS
|
||||||
|
) ENGINE=innodb;
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
-- Copyright (C) 2016 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/.
|
||||||
|
|
||||||
|
create table llx_websiteaccount_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ Module5000Desc=Allows you to manage multiple companies
|
|||||||
Module6000Name=Workflow
|
Module6000Name=Workflow
|
||||||
Module6000Desc=Workflow management
|
Module6000Desc=Workflow management
|
||||||
Module10000Name=Websites
|
Module10000Name=Websites
|
||||||
Module10000Desc=Create public websites with a WYSIWG editor. Just setup your web server to point to the dedicated directory to have it online on the Internet.
|
Module10000Desc=Create public websites with a WYSIWG editor. Just setup your web server (Apache, Nginx, ...) to point to the dedicated Dolibarr directory to have it online on the Internet with your own domain name.
|
||||||
Module20000Name=Leave Requests management
|
Module20000Name=Leave Requests management
|
||||||
Module20000Desc=Declare and follow employees leaves requests
|
Module20000Desc=Declare and follow employees leaves requests
|
||||||
Module39000Name=Product lot
|
Module39000Name=Product lot
|
||||||
@ -1129,7 +1129,7 @@ SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail dire
|
|||||||
TranslationSetup=Setup of translation
|
TranslationSetup=Setup of translation
|
||||||
TranslationKeySearch=Search a translation key or string
|
TranslationKeySearch=Search a translation key or string
|
||||||
TranslationOverwriteKey=Overwrite a translation string
|
TranslationOverwriteKey=Overwrite a translation string
|
||||||
TranslationDesc=How to set displayed application language :<br>* Systemwide: menu <strong>Home - Setup - Display</strong><br>* Per user: <strong>User display setup</strong> tab of user card (click on username at the top of the screen).
|
TranslationDesc=How to set displayed application language :<br>* Systemwide: menu <strong>Home - Setup - Display</strong><br>* Per user: Use the <strong>User display setup</strong> tab on user card (click on username at the top of the screen).
|
||||||
TranslationOverwriteDesc=You can also override strings filling the following table. Choose your language from "%s" dropdown, insert the translation key string into "%s" and your new translation into "%s"
|
TranslationOverwriteDesc=You can also override strings filling the following table. Choose your language from "%s" dropdown, insert the translation key string into "%s" and your new translation into "%s"
|
||||||
TranslationOverwriteDesc2=You can use the other tab to help you know translation key to use
|
TranslationOverwriteDesc2=You can use the other tab to help you know translation key to use
|
||||||
TranslationString=Translation string
|
TranslationString=Translation string
|
||||||
|
|||||||
@ -47,6 +47,7 @@ SpecificationFile=File with business rules
|
|||||||
LanguageFile=File for language
|
LanguageFile=File for language
|
||||||
ConfirmDeleteProperty=Are you sure you want to delete the property <strong>%s</strong> ? This will change code in PHP class but also remove column from table definition of object.
|
ConfirmDeleteProperty=Are you sure you want to delete the property <strong>%s</strong> ? This will change code in PHP class but also remove column from table definition of object.
|
||||||
NotNull=Not NULL
|
NotNull=Not NULL
|
||||||
|
NotNullDesc=1=Set database to NOT NULL. -1=Allow null values and force value to NULL if empty ('' or 0).
|
||||||
SearchAll=Used for 'search all'
|
SearchAll=Used for 'search all'
|
||||||
DatabaseIndex=Database index
|
DatabaseIndex=Database index
|
||||||
FileAlreadyExists=File %s already exists
|
FileAlreadyExists=File %s already exists
|
||||||
|
|||||||
@ -51,4 +51,5 @@ OrEnterPageInfoManually=Or create empty page from scratch...
|
|||||||
FetchAndCreate=Fetch and Create
|
FetchAndCreate=Fetch and Create
|
||||||
ExportSite=Export site
|
ExportSite=Export site
|
||||||
IDOfPage=Id of page
|
IDOfPage=Id of page
|
||||||
WebsiteAccounts=Web sites accounts
|
WebsiteAccounts=Web site accounts
|
||||||
|
AddWebsiteAccount=Create web site account
|
||||||
@ -1529,7 +1529,7 @@ elseif (! empty($module))
|
|||||||
{
|
{
|
||||||
$reflector = new ReflectionClass($tabobj);
|
$reflector = new ReflectionClass($tabobj);
|
||||||
$properties = $reflector->getProperties(); // Can also use get_object_vars
|
$properties = $reflector->getProperties(); // Can also use get_object_vars
|
||||||
$propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars
|
//$propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars
|
||||||
//$propstat = $reflector->getStaticProperties();
|
//$propstat = $reflector->getStaticProperties();
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("Properties"), '', '');
|
print load_fiche_titre($langs->trans("Properties"), '', '');
|
||||||
@ -1553,8 +1553,8 @@ elseif (! empty($module))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
print '<td>'.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).'</td>';
|
print '<td>'.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).'</td>';
|
||||||
print '<td class="center">'.$langs->trans("NotNull").'</td>';
|
print '<td class="center">'.$form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")).'</td>';
|
||||||
//print '<td>'.$langs->trans("DefaultValue").'</td>';
|
print '<td class="center">'.$langs->trans("DefaultValue").'</td>';
|
||||||
print '<td class="center">'.$langs->trans("DatabaseIndex").'</td>';
|
print '<td class="center">'.$langs->trans("DatabaseIndex").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("Position").'</td>';
|
print '<td class="right">'.$langs->trans("Position").'</td>';
|
||||||
print '<td class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</td>';
|
print '<td class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</td>';
|
||||||
@ -1576,7 +1576,7 @@ elseif (! empty($module))
|
|||||||
print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype','alpha')).'"></td>';
|
print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype','alpha')).'"></td>';
|
||||||
print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval','none')).'"></td>';
|
print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval','none')).'"></td>';
|
||||||
print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull','alpha')).'"></td>';
|
print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull','alpha')).'"></td>';
|
||||||
//print '<td><input class="text" name="propdefault" value=""></td>';
|
print '<td><input class="text" name="propdefault" value="'.dol_escape_htmltag(GETPOST('propdefault','alpha')).'"></td>';
|
||||||
print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex','alpha')).'"></td>';
|
print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex','alpha')).'"></td>';
|
||||||
print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition','alpha')).'"></td>';
|
print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition','alpha')).'"></td>';
|
||||||
print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled','alpha')).'"></td>';
|
print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled','alpha')).'"></td>';
|
||||||
@ -1598,7 +1598,7 @@ elseif (! empty($module))
|
|||||||
$type=gettype($tmpobjet->$propname);
|
$type=gettype($tmpobjet->$propname);
|
||||||
$default=$propdefault[$propname];
|
$default=$propdefault[$propname];
|
||||||
// Discard generic properties
|
// Discard generic properties
|
||||||
if (in_array($propname, array('element', 'childtables', 'table_element', 'table_element_line', 'class_element_line', 'isnolinkedbythird', 'ismultientitymanaged'))) continue;
|
if (in_array($propname, array('element', 'childtables', 'table_element', 'table_element_line', 'class_element_line', 'ismultientitymanaged'))) continue;
|
||||||
|
|
||||||
// Keep or not lines
|
// Keep or not lines
|
||||||
if (in_array($propname, array('fk_element', 'lines'))) continue;
|
if (in_array($propname, array('fk_element', 'lines'))) continue;
|
||||||
@ -1610,7 +1610,7 @@ elseif (! empty($module))
|
|||||||
$proparrayofkeyval=$propval['arrayofkeyval'];
|
$proparrayofkeyval=$propval['arrayofkeyval'];
|
||||||
$propnotnull=$propval['notnull'];
|
$propnotnull=$propval['notnull'];
|
||||||
$propsearchall=$propval['searchall'];
|
$propsearchall=$propval['searchall'];
|
||||||
//$propdefault=$propval['default'];
|
$propdefault=$propval['default'];
|
||||||
$propindex=$propval['index'];
|
$propindex=$propval['index'];
|
||||||
$propposition=$propval['position'];
|
$propposition=$propval['position'];
|
||||||
$propenabled=$propval['enabled'];
|
$propenabled=$propval['enabled'];
|
||||||
@ -1638,11 +1638,11 @@ elseif (! empty($module))
|
|||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $propnotnull;
|
print $propnotnull;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
/*print '<td>';
|
print '<td>';
|
||||||
print $propdefault;
|
print $propdefault;
|
||||||
print '</td>';*/
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $propindex?'X':'';
|
print $propindex?'1':'';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $propposition;
|
print $propposition;
|
||||||
@ -1657,7 +1657,7 @@ elseif (! empty($module))
|
|||||||
print $propisameasure?$propisameasure:'';
|
print $propisameasure?$propisameasure:'';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $propsearchall?'X':'';
|
print $propsearchall?'1':'';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $propcomment;
|
print $propcomment;
|
||||||
|
|||||||
@ -44,14 +44,10 @@ class MyObject extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $table_element = 'myobject';
|
public $table_element = 'myobject';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array Does this field is linked to a thirdparty ?
|
|
||||||
*/
|
|
||||||
protected $isnolinkedbythird = 1;
|
|
||||||
/**
|
/**
|
||||||
* @var array Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
* @var array Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
*/
|
*/
|
||||||
protected $ismultientitymanaged = 1;
|
protected $ismultientitymanaged = 0;
|
||||||
/**
|
/**
|
||||||
* @var string String with name of icon for myobject
|
* @var string String with name of icon for myobject
|
||||||
*/
|
*/
|
||||||
@ -80,9 +76,9 @@ class MyObject extends CommonObject
|
|||||||
public $fields=array(
|
public $fields=array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||||
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200'),
|
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200'),
|
||||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
|
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
|
||||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>45),
|
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>45),
|
||||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>46),
|
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>46),
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
|
|||||||
@ -213,7 +213,8 @@ $sql.=$hookmanager->resPrint;
|
|||||||
$sql=preg_replace('/, $/','', $sql);
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."myobject as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."myobject as t";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE t.entity IN (".getEntity('myobject').")";
|
if ($object->getIsmultientitymanaged() == 1) $sql.= " WHERE t.entity IN (".getEntity('myobject').")";
|
||||||
|
else $sql.=" WHERE 1 = 1";
|
||||||
foreach($search as $key => $val)
|
foreach($search as $key => $val)
|
||||||
{
|
{
|
||||||
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
||||||
@ -265,7 +266,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
dol_syslog($script_file, LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
@ -351,9 +351,9 @@ if ($sall)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
/*$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||||
$moreforfilter.= '</div>';
|
$moreforfilter.= '</div>';*/
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@ -47,7 +47,6 @@ class Product extends CommonObject
|
|||||||
public $table_element='product';
|
public $table_element='product';
|
||||||
public $fk_element='fk_product';
|
public $fk_element='fk_product';
|
||||||
protected $childtables=array('supplier_proposaldet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
|
protected $childtables=array('supplier_proposaldet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
|
||||||
protected $isnolinkedbythird = 1; // No field fk_soc
|
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -44,10 +44,6 @@ class Inventory extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $table_element = 'inventory';
|
public $table_element = 'inventory';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array Does this field is linked to a thirdparty ?
|
|
||||||
*/
|
|
||||||
protected $isnolinkedbythird = 1;
|
|
||||||
/**
|
/**
|
||||||
* @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
* @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -46,7 +46,6 @@ class Productlot extends CommonObject
|
|||||||
|
|
||||||
public $picto='barcode';
|
public $picto='barcode';
|
||||||
|
|
||||||
public $isnolinkedbythird = 1;
|
|
||||||
public $ismultientitymanaged = 1;
|
public $ismultientitymanaged = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/public/websites/index.php
|
* \file htdocs/public/website/index.php
|
||||||
* \ingroup website
|
* \ingroup website
|
||||||
* \brief Page to output pages
|
* \brief Page to output pages
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
@ -66,8 +66,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP
|
|||||||
|
|
||||||
if (empty($pageid))
|
if (empty($pageid))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
|
|
||||||
$object=new Website($db);
|
$object=new Website($db);
|
||||||
$object->fetch(0, $websitekey);
|
$object->fetch(0, $websitekey);
|
||||||
@ -138,11 +138,11 @@ if ($pageid == 'css') // No more used ?
|
|||||||
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
//else
|
//else
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
$original_file=$dolibarr_main_data_root.'/websites/'.$websitekey.'/styles.css.php';
|
$original_file=$dolibarr_main_data_root.'/website/'.$websitekey.'/styles.css.php';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$original_file=$dolibarr_main_data_root.'/websites/'.$websitekey.'/page'.$pageid.'.tpl.php';
|
$original_file=$dolibarr_main_data_root.'/website/'.$websitekey.'/page'.$pageid.'.tpl.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the subdirectory name as the reference
|
// Find the subdirectory name as the reference
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/public/websites/styles.css.php
|
* \file htdocs/public/website/styles.css.php
|
||||||
* \ingroup website
|
* \ingroup website
|
||||||
* \brief Page to output style page. Called with <link rel="stylesheet" href="styles.css.php?websiteid=123" type="text/css" />
|
* \brief Page to output style page. Called with <link rel="stylesheet" href="styles.css.php?websiteid=123" type="text/css" />
|
||||||
*/
|
*/
|
||||||
@ -65,8 +65,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP
|
|||||||
|
|
||||||
if (empty($pageid))
|
if (empty($pageid))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
|
|
||||||
$object=new Website($db);
|
$object=new Website($db);
|
||||||
if ($websiteid)
|
if ($websiteid)
|
||||||
@ -97,7 +97,7 @@ if (empty($pageid))
|
|||||||
// Security: Delete string ../ into $original_file
|
// Security: Delete string ../ into $original_file
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
|
|
||||||
$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php';
|
$original_file=$dolibarr_main_data_root.'/website/'.$website.'/styles.css.php';
|
||||||
|
|
||||||
// Find the subdirectory name as the reference
|
// Find the subdirectory name as the reference
|
||||||
$refname=basename(dirname($original_file)."/");
|
$refname=basename(dirname($original_file)."/");
|
||||||
|
|||||||
@ -43,7 +43,7 @@ $langs->load("main");
|
|||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$ref = GETPOST('ref');
|
$ref = GETPOST('ref','alpha');
|
||||||
$description = GETPOST('description');
|
$description = GETPOST('description');
|
||||||
$confirm = GETPOST('confirm');
|
$confirm = GETPOST('confirm');
|
||||||
$fk_code_type_resource = GETPOST('fk_code_type_resource','alpha');
|
$fk_code_type_resource = GETPOST('fk_code_type_resource','alpha');
|
||||||
@ -58,8 +58,8 @@ if (! $user->rights->resource->read)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$object = new Dolresource($db);
|
$object = new Dolresource($db);
|
||||||
$objectFetchRes = $object->fetch($id);
|
$result = $object->fetch($id, $ref);
|
||||||
if (! ($objectFetchRes > 0)) dol_print_error($db, $object->error);
|
if (! ($result > 0)) dol_print_error($db, $object->error);
|
||||||
|
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
@ -68,7 +68,7 @@ $extrafields = new ExtraFields($db);
|
|||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$hookmanager->initHooks(array('resource_card','globalcard'));
|
$hookmanager->initHooks(array('resource_card','globalcard'));
|
||||||
$parameters=array('resource_id'=>$id);
|
$parameters=array('resource_id'=>$object->id);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
@ -159,17 +159,17 @@ if (empty($reshook))
|
|||||||
*
|
*
|
||||||
* Put here all code to build page
|
* Put here all code to build page
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
$pagetitle = $langs->trans('ResourceCard');
|
$pagetitle = $langs->trans('ResourceCard');
|
||||||
llxHeader('',$pagetitle,'');
|
llxHeader('',$pagetitle,'');
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formresource = new FormResource($db);
|
$formresource = new FormResource($db);
|
||||||
|
|
||||||
if ( $objectFetchRes > 0 )
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$head=resource_prepare_head($object);
|
$head=resource_prepare_head($object);
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'edit' )
|
if ($action == 'edit' )
|
||||||
{
|
{
|
||||||
if ( ! $user->rights->resource->write )
|
if ( ! $user->rights->resource->write )
|
||||||
@ -189,7 +189,7 @@ if ( $objectFetchRes > 0 )
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("ResourceFormLabel_ref").'</td>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("ResourceFormLabel_ref").'</td>';
|
||||||
print '<td><input size="12" name="ref" value="'.(GETPOST('ref') ? GETPOST('ref') : $object->ref).'"></td></tr>';
|
print '<td><input class="minwidth200" name="ref" value="'.(GETPOST('ref') ? GETPOST('ref') : $object->ref).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>'.$langs->trans("ResourceType").'</td>';
|
print '<tr><td>'.$langs->trans("ResourceType").'</td>';
|
||||||
@ -200,7 +200,7 @@ if ( $objectFetchRes > 0 )
|
|||||||
// Description
|
// Description
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<textarea name="description" cols="80" rows="'.ROWS_3.'">'.($_POST['description'] ? GETPOST('description','alpha') : $object->description).'</textarea>';
|
print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($_POST['description'] ? GETPOST('description','alpha') : $object->description).'</textarea>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
@ -232,7 +232,7 @@ if ( $objectFetchRes > 0 )
|
|||||||
// Confirm deleting resource line
|
// Confirm deleting resource line
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$formconfirm = $form->formconfirm("card.php?&id=".$id,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResource"),"confirm_delete_resource",'','',1);
|
$formconfirm = $form->formconfirm("card.php?&id=".$object->id,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResource"),"confirm_delete_resource",'','',1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
@ -246,7 +246,7 @@ if ( $objectFetchRes > 0 )
|
|||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
@ -302,7 +302,7 @@ if ( $objectFetchRes > 0 )
|
|||||||
if($user->rights->resource->write)
|
if($user->rights->resource->write)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction">';
|
print '<div class="inline-block divButAction">';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=edit" class="butAction">'.$langs->trans('Modify').'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans('Modify').'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ if ( $objectFetchRes > 0 )
|
|||||||
if($user->rights->resource->delete)
|
if($user->rights->resource->delete)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction">';
|
print '<div class="inline-block divButAction">';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete" class="butActionDelete">'.$langs->trans('Delete').'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans('Delete').'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,10 +169,11 @@ class Dolresource extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load object in memory from database
|
* Load object in memory from database
|
||||||
*
|
*
|
||||||
* @param int $id id object
|
* @param int $id Id of object
|
||||||
|
* @param string $ref Ref of object
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id, $ref='')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
@ -187,7 +188,8 @@ class Dolresource extends CommonObject
|
|||||||
$sql.= " ty.label as type_label";
|
$sql.= " ty.label as type_label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource";
|
||||||
$sql.= " WHERE t.rowid = ".$this->db->escape($id);
|
if ($id) $sql.= " WHERE t.rowid = ".$this->db->escape($id);
|
||||||
|
else $sql.= " WHERE t.ref = '".$this->db->escape($ref)."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -751,75 +753,6 @@ class Dolresource extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load properties id_previous and id_next
|
|
||||||
*
|
|
||||||
* @param string $filter Optional filter
|
|
||||||
* @param int $fieldid Name of field to use for the select MAX and MIN
|
|
||||||
* @param int $nodbprefix Do not include DB prefix to forge table name
|
|
||||||
* @return int <0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function load_previous_next_ref($filter, $fieldid, $nodbprefix =0)
|
|
||||||
{
|
|
||||||
global $conf, $user;
|
|
||||||
|
|
||||||
if (! $this->table_element)
|
|
||||||
{
|
|
||||||
dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this->ismultientitymanaged contains
|
|
||||||
// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
|
||||||
$alias = 's';
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
|
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
|
||||||
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->id)."'";
|
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
|
||||||
if (! empty($filter)) $sql.=" AND ".$filter;
|
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
|
||||||
|
|
||||||
//print $sql."<br>";
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if (! $result)
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
$row = $this->db->fetch_row($result);
|
|
||||||
$this->ref_previous = $row[0];
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
|
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
|
||||||
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->id)."'";
|
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
|
||||||
if (! empty($filter)) $sql.=" AND ".$filter;
|
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
|
||||||
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
|
|
||||||
|
|
||||||
//print $sql."<br>";
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if (! $result)
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
$row = $this->db->fetch_row($result);
|
|
||||||
$this->ref_next = $row[0];
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update element resource into database
|
* Update element resource into database
|
||||||
*
|
*
|
||||||
|
|||||||
@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|||||||
@ -108,7 +108,7 @@ if ($object->id)
|
|||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
@ -134,7 +134,7 @@ if ($object->id)
|
|||||||
|
|
||||||
$modulepart = 'dolresource';
|
$modulepart = 'dolresource';
|
||||||
$permission = $user->rights->resource->write;
|
$permission = $user->rights->resource->write;
|
||||||
$param = '&id=' . $object->id;
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|||||||
@ -23,15 +23,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/societe/website.php
|
* \file htdocs/societe/website.php
|
||||||
* \ingroup societe
|
* \ingroup website
|
||||||
* \brief Page of web sites accounts
|
* \brief Page of web sites accounts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/website/class/websiteaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("companies","website"));
|
||||||
|
|
||||||
$search_status=GETPOST('search_status');
|
$search_status=GETPOST('search_status');
|
||||||
|
|
||||||
@ -48,12 +51,60 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
|||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield) $sortfield='a.login';
|
if (! $sortfield) $sortfield='t.login';
|
||||||
if (! $sortorder) $sortorder='ASC';
|
if (! $sortorder) $sortorder='ASC';
|
||||||
|
|
||||||
|
// Initialize technical objects
|
||||||
|
$object=new Societe($db);
|
||||||
|
$objectwebsiteaccount=new WebsiteAccount($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
$hookmanager->initHooks(array('websiteaccountlist')); // Note that conf->hooks_modules contains array
|
||||||
|
// Fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('websiteaccount');
|
||||||
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
|
unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('websitethirdparty'));
|
$hookmanager->initHooks(array('websitethirdparty'));
|
||||||
|
|
||||||
|
// Initialize array of search criterias
|
||||||
|
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||||
|
$search=array();
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of fields to search into when doing a "search in all"
|
||||||
|
$fieldstosearchall = array();
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Definition of fields for list
|
||||||
|
$arrayfields=array();
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
// If $val['visible']==0, then we never show the field
|
||||||
|
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$result = $object->fetch($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -72,12 +123,32 @@ if (empty($reshook))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$actioncode='';
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
$search_agenda_label='';
|
{
|
||||||
|
$search[$key]='';
|
||||||
}
|
}
|
||||||
|
$toselect='';
|
||||||
|
$search_array_options=array();
|
||||||
|
}
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||||
|
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||||
|
{
|
||||||
|
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass='WebsiteAccount';
|
||||||
|
$objectlabel='WebsiteAccount';
|
||||||
|
$permtoread = $user->rights->societe->lire;
|
||||||
|
$permtodelete = $user->rights->societe->supprimer;
|
||||||
|
$uploaddir = $conf->societe->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -90,23 +161,31 @@ $contactstatic = new Contact($db);
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if ($id > 0)
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
|
$title = $langs->trans("WebsiteAccounts");
|
||||||
$object = new Societe($db);
|
|
||||||
$result = $object->fetch($id);
|
|
||||||
|
|
||||||
$title=$langs->trans("WebisteAccounts");
|
|
||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($id > 0) $param.='&id='.urlencode($id);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
foreach($search as $key => $val)
|
||||||
|
{
|
||||||
|
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
|
}
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
|
// Add $param from extra fields
|
||||||
|
foreach ($search_array_options as $key => $val)
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
|
}
|
||||||
|
|
||||||
$head = societe_prepare_head($object);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'websites', $langs->trans("ThirdParty"), -1, 'company');
|
dol_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company');
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/societe/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/societe/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
@ -124,21 +203,21 @@ if ($id > 0)
|
|||||||
print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->client)
|
if ($object->client) {
|
||||||
{
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('CustomerCode') . '</td><td colspan="3">';
|
print $langs->trans('CustomerCode') . '</td><td colspan="3">';
|
||||||
print $object->code_client;
|
print $object->code_client;
|
||||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
if ($object->check_codeclient() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->fournisseur)
|
if ($object->fournisseur) {
|
||||||
{
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('SupplierCode') . '</td><td colspan="3">';
|
print $langs->trans('SupplierCode') . '</td><td colspan="3">';
|
||||||
print $object->code_fournisseur;
|
print $object->code_fournisseur;
|
||||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
if ($object->check_codefournisseur() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,35 +227,435 @@ if ($id > 0)
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$morehtmlcenter = '';
|
$morehtmlcenter = '';
|
||||||
if (! empty($conf->website->enabled))
|
if (! empty($conf->website->enabled)) {
|
||||||
{
|
if (! empty($user->rights->societe->lire)) {
|
||||||
if (! empty($user->rights->societe->lire))
|
$morehtmlcenter .= '<a class="butAction" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create' . $param . '">' . $langs->trans("AddWebsiteAccount") . '</a>';
|
||||||
{
|
} else {
|
||||||
$morehtmlcenter.='<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=create'.$out.'">'.$langs->trans("AddWebsiteAccount").'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$morehtmlcenter .= '<a class="butActionRefused" href="#">' . $langs->trans("AddAction") . '</a>';
|
$morehtmlcenter .= '<a class="butActionRefused" href="#">' . $langs->trans("AddAction") . '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$param='&id='.$id;
|
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("WebsiteAccounts"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Build and execute select
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
$sql = 'SELECT ';
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$sql.='t.'.$key.', ';
|
||||||
}
|
}
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as t";
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."websiteaccount_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
|
if ($objectwebsiteaccount->getIsmultientitymanaged() == 1) $sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")";
|
||||||
|
else $sql.=" WHERE 1 = 1";
|
||||||
|
foreach($search as $key => $val)
|
||||||
|
{
|
||||||
|
$mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0);
|
||||||
|
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
|
||||||
|
}
|
||||||
|
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
|
// Add where from extra fields
|
||||||
|
foreach ($search_array_options as $key => $val)
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
$typ=$extrafields->attribute_type[$tmpkey];
|
||||||
|
$mode_search=0;
|
||||||
|
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||||
|
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||||
|
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
||||||
|
{
|
||||||
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
/* If a group by is required
|
||||||
|
$sql.= " GROUP BY "
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$sql.='t.'.$key.', ';
|
||||||
|
}
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $objectwebsiteaccount may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql.=$db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
|
// Count total nb of records
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
|
// List of mass actions available
|
||||||
|
$arrayofmassactions = array(
|
||||||
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
|
);
|
||||||
|
if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||||
|
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||||
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton.' '.$morehtmlcenter, $num, $nbtotalofrecords, 'unlock', 0, '', '', $limit);
|
||||||
|
|
||||||
|
if ($sall)
|
||||||
|
{
|
||||||
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
|
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*$moreforfilter = '';
|
||||||
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
|
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||||
|
$moreforfilter.= '</div>';*/
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook
|
||||||
|
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||||
|
else $moreforfilter = $hookmanager->resPrint;
|
||||||
|
|
||||||
|
if (! empty($moreforfilter))
|
||||||
|
{
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Fields title search
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||||
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
|
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
$searchclass='';
|
||||||
|
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||||
|
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||||
|
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Rest of fields search
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Fields title label
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
$sortonfield = "ef.".$key;
|
||||||
|
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||||
|
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Hook fields
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Rest of fields title
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||||
|
}
|
||||||
|
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Detect if we need a fetch on each output line
|
||||||
|
$needToFetchEachLine=0;
|
||||||
|
foreach ($extrafields->attribute_computed as $key => $val)
|
||||||
|
{
|
||||||
|
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Loop on record
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
$i=0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if (empty($obj)) break; // Should not happen
|
||||||
|
|
||||||
|
// Store properties in $object
|
||||||
|
$objectwebsiteaccount->id = $obj->rowid;
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show here line of result
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue; // Discard some field output at end
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||||
|
if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser');
|
||||||
|
elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
|
||||||
|
elseif ($key == 'ref') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
|
||||||
|
elseif ($key == 'status') print $objectwebsiteaccount->getLibStatut(3);
|
||||||
|
else print $obj->$key;
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! empty($val['isameasure']))
|
||||||
|
{
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||||
|
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td';
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
if ($align) print ' align="'.$align.'"';
|
||||||
|
print '>';
|
||||||
|
$tmpkey='options_'.$key;
|
||||||
|
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! empty($val['isameasure']))
|
||||||
|
{
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
|
||||||
|
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Rest of fields
|
||||||
|
foreach($objectwebsiteaccount->fields as $key => $val)
|
||||||
|
{
|
||||||
|
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue; // Keep only field not yet already output
|
||||||
|
$align='';
|
||||||
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||||
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
|
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||||
|
if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser');
|
||||||
|
elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
|
||||||
|
elseif ($key == 'status') print $objectwebsiteaccount->getLibStatut(3);
|
||||||
|
else print $obj->$key;
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! empty($val['isameasure']))
|
||||||
|
{
|
||||||
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||||
|
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
{
|
||||||
|
$selected=0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show total line
|
||||||
|
if (isset($totalarray['pos']))
|
||||||
|
{
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
$i=0;
|
||||||
|
while ($i < $totalarray['nbfield'])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($i == 1)
|
||||||
|
{
|
||||||
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
}
|
||||||
|
else print '<td></td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no record found
|
||||||
|
if ($num == 0)
|
||||||
|
{
|
||||||
|
$colspan=1;
|
||||||
|
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||||
|
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
print '</table>'."\n";
|
||||||
|
print '</div>'."\n";
|
||||||
|
|
||||||
|
print '</form>'."\n";
|
||||||
|
|
||||||
|
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||||
|
{
|
||||||
|
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
|
// Show list of available documents
|
||||||
|
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||||
|
$urlsource.=str_replace('&','&',$param);
|
||||||
|
|
||||||
|
$filedir=$diroutputmassaction;
|
||||||
|
$genallowed=$user->rights->mymodule->read;
|
||||||
|
$delallowed=$user->rights->mymodule->create;
|
||||||
|
|
||||||
|
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -1566,7 +1566,7 @@ div.mainmenu.tools {
|
|||||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>);
|
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.mainmenu.websites {
|
div.mainmenu.website {
|
||||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>);
|
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,8 +1752,8 @@ table.login_table_securitycode tr td {
|
|||||||
div.login_block {
|
div.login_block {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-align: <?php print $right; ?>;
|
text-align: <?php print $right; ?>;
|
||||||
<?php print $right; ?>: 5px;
|
<?php print $right; ?>: 0;
|
||||||
top: 4px;
|
top: 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
max-width: <?php echo $maxwidthloginblock; ?>px;
|
max-width: <?php echo $maxwidthloginblock; ?>px;
|
||||||
<?php if (GETPOST('optioncss','aZ09') == 'print') { ?>
|
<?php if (GETPOST('optioncss','aZ09') == 'print') { ?>
|
||||||
@ -1780,6 +1780,7 @@ div.login a:hover {
|
|||||||
}
|
}
|
||||||
div.login_block_user {
|
div.login_block_user {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
padding-top: 3px;
|
||||||
<?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?>
|
<?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?>
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -4901,16 +4902,17 @@ div.tabsElem a.tab {
|
|||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
padding-top: 10px;
|
padding-top: 5px;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
top: inherit !important;
|
top: inherit !important;
|
||||||
left: 0 !important;
|
left: 0 !important;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
height: 42px;
|
height: 50px;
|
||||||
|
|
||||||
z-index: 202;
|
z-index: 202;
|
||||||
min-width: 190px;
|
min-width: 190px;
|
||||||
|
|||||||
@ -1602,7 +1602,7 @@ div.mainmenu.tools {
|
|||||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>);
|
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.mainmenu.websites {
|
div.mainmenu.website {
|
||||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>);
|
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file websites/website.class.php
|
* \file website/website.class.php
|
||||||
* \ingroup websites
|
* \ingroup website
|
||||||
* \brief File for the CRUD class of website (Create/Read/Update/Delete)
|
* \brief File for the CRUD class of website (Create/Read/Update/Delete)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -509,8 +509,8 @@ class Website extends CommonObject
|
|||||||
|
|
||||||
$oldidforhome=$object->fk_default_home;
|
$oldidforhome=$object->fk_default_home;
|
||||||
|
|
||||||
$pathofwebsiteold=$dolibarr_main_data_root.'/websites/'.$object->ref;
|
$pathofwebsiteold=$dolibarr_main_data_root.'/website/'.$object->ref;
|
||||||
$pathofwebsitenew=$dolibarr_main_data_root.'/websites/'.$newref;
|
$pathofwebsitenew=$dolibarr_main_data_root.'/website/'.$newref;
|
||||||
dol_delete_dir_recursive($pathofwebsitenew);
|
dol_delete_dir_recursive($pathofwebsitenew);
|
||||||
|
|
||||||
$fileindex=$pathofwebsitenew.'/index.php';
|
$fileindex=$pathofwebsitenew.'/index.php';
|
||||||
@ -652,7 +652,7 @@ class Website extends CommonObject
|
|||||||
$label.= '<div width="100%">';
|
$label.= '<div width="100%">';
|
||||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/websites/card.php?id='.$this->id.'"';
|
$link = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
|
||||||
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
||||||
$link.= '>';
|
$link.= '>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
491
htdocs/website/class/websiteaccount.class.php
Normal file
491
htdocs/website/class/websiteaccount.class.php
Normal file
@ -0,0 +1,491 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file class/websiteaccount.class.php
|
||||||
|
* \ingroup website
|
||||||
|
* \brief This file is a CRUD class file for WebsiteAccount (Create/Read/Update/Delete)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Put here all includes required by your class file
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||||
|
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
|
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for WebsiteAccount
|
||||||
|
*/
|
||||||
|
class WebsiteAccount extends CommonObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string ID to identify managed object
|
||||||
|
*/
|
||||||
|
public $element = 'websiteaccount';
|
||||||
|
/**
|
||||||
|
* @var string Name of table without prefix where object is stored
|
||||||
|
*/
|
||||||
|
public $table_element = 'websiteaccount';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
*/
|
||||||
|
protected $ismultientitymanaged = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string String with name of icon for websiteaccount
|
||||||
|
*/
|
||||||
|
public $picto = 'object_globe';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'type' if the field format.
|
||||||
|
* 'label' the translation key.
|
||||||
|
* 'enabled' is a condition when the filed must be managed.
|
||||||
|
* 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
|
||||||
|
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||||
|
* 'index' if we want an index in database.
|
||||||
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
|
* 'position' is the sort order of field.
|
||||||
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'help' is a string visible as a tooltip on field
|
||||||
|
* 'comment' is not used. You can store here any text of your choice.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
|
/**
|
||||||
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
|
*/
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
|
||||||
|
'login' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',),
|
||||||
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1,),
|
||||||
|
'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
|
||||||
|
'note_private' => array('type'=>'text', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,),
|
||||||
|
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||||
|
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||||
|
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||||
|
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
|
||||||
|
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
|
||||||
|
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Active')),
|
||||||
|
'fk_soc' => array('type'=>'integer', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1,),
|
||||||
|
);
|
||||||
|
public $rowid;
|
||||||
|
public $login;
|
||||||
|
public $label;
|
||||||
|
public $note_public;
|
||||||
|
public $note_private;
|
||||||
|
public $date_creation;
|
||||||
|
public $tms;
|
||||||
|
public $fk_user_creat;
|
||||||
|
public $fk_user_modif;
|
||||||
|
public $import_key;
|
||||||
|
public $status;
|
||||||
|
public $fk_soc;
|
||||||
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// If this object has a subtable with lines
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Name of subtable line
|
||||||
|
*/
|
||||||
|
//public $table_element_line = 'websiteaccountdet';
|
||||||
|
/**
|
||||||
|
* @var int Field with ID of parent key if this field has a parent
|
||||||
|
*/
|
||||||
|
//public $fk_element = 'fk_websiteaccount';
|
||||||
|
/**
|
||||||
|
* @var int Name of subtable class that manage subtable lines
|
||||||
|
*/
|
||||||
|
//public $class_element_line = 'WebsiteAccountline';
|
||||||
|
/**
|
||||||
|
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||||
|
*/
|
||||||
|
//protected $childtables=array('websiteaccountdet');
|
||||||
|
/**
|
||||||
|
* @var WebsiteAccountLine[] Array of subtable lines
|
||||||
|
*/
|
||||||
|
//public $lines = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB $db)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$this->db = $db;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that creates
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
* @return int <0 if KO, Id of created object if OK
|
||||||
|
*/
|
||||||
|
public function create(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
return $this->createCommon($user, $notrigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone and object into another one
|
||||||
|
*
|
||||||
|
* @param User $user User that creates
|
||||||
|
* @param int $fromid Id of object to clone
|
||||||
|
* @return mixed New object created, <0 if KO
|
||||||
|
*/
|
||||||
|
public function createFromClone(User $user, $fromid)
|
||||||
|
{
|
||||||
|
global $hookmanager, $langs;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$object = new self($this->db);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$object->fetchCommon($fromid);
|
||||||
|
// Reset some properties
|
||||||
|
unset($object->id);
|
||||||
|
unset($object->fk_user_creat);
|
||||||
|
unset($object->import_key);
|
||||||
|
|
||||||
|
// Clear fields
|
||||||
|
$object->ref = "copy_of_".$object->ref;
|
||||||
|
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// Create clone
|
||||||
|
$object->context['createfromclone'] = 'createfromclone';
|
||||||
|
$result = $object->createCommon($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
$this->error = $object->error;
|
||||||
|
$this->errors = $object->errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End
|
||||||
|
if (!$error) {
|
||||||
|
$this->db->commit();
|
||||||
|
return $object;
|
||||||
|
} else {
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param int $id Id object
|
||||||
|
* @param string $ref Ref
|
||||||
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetch($id, $ref = null)
|
||||||
|
{
|
||||||
|
$result = $this->fetchCommon($id, $ref);
|
||||||
|
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object lines in memory from the database
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetchLines()
|
||||||
|
{
|
||||||
|
$this->lines=array();
|
||||||
|
|
||||||
|
// Load lines with object WebsiteAccountLine
|
||||||
|
|
||||||
|
return count($this->lines)?1:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that modifies
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function update(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
return $this->updateCommon($user, $notrigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete object in database
|
||||||
|
*
|
||||||
|
* @param User $user User that deletes
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function delete(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
return $this->deleteCommon($user, $notrigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a link to the object card (with optionaly the picto)
|
||||||
|
*
|
||||||
|
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||||
|
* @param string $option On what the link point to ('nolink', ...)
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
|
* @param string $morecss Add more css on link
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
|
* @return string String with URL
|
||||||
|
*/
|
||||||
|
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
|
||||||
|
{
|
||||||
|
global $db, $conf, $langs;
|
||||||
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
|
global $menumanager;
|
||||||
|
|
||||||
|
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
$companylink = '';
|
||||||
|
|
||||||
|
$label = '<u>' . $langs->trans("WebsiteAccount") . '</u>';
|
||||||
|
$label.= '<br>';
|
||||||
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
|
||||||
|
$url = dol_buildpath('/website/websiteaccount_card.php',1).'?id='.$this->id;
|
||||||
|
|
||||||
|
if ($option != 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$linkclose='';
|
||||||
|
if (empty($notooltip))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
|
{
|
||||||
|
$label=$langs->trans("ShowWebsiteAccount");
|
||||||
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
}
|
||||||
|
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||||
|
}
|
||||||
|
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||||
|
|
||||||
|
$linkstart = '<a href="'.$url.'"';
|
||||||
|
$linkstart.=$linkclose.'>';
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
|
if ($withpicto)
|
||||||
|
{
|
||||||
|
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||||
|
if ($withpicto != 2) $result.=' ';
|
||||||
|
}
|
||||||
|
$result.= $linkstart . $this->ref . $linkend;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return link to download file from a direct external access
|
||||||
|
*
|
||||||
|
* @param int $withpicto Add download picto into link
|
||||||
|
* @return string HTML link to file
|
||||||
|
*/
|
||||||
|
function getDirectExternalLink($withpicto=0)
|
||||||
|
{
|
||||||
|
return 'todo';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le libelle du status d'un user (actif, inactif)
|
||||||
|
*
|
||||||
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
|
* @return string Label of status
|
||||||
|
*/
|
||||||
|
function getLibStatut($mode=0)
|
||||||
|
{
|
||||||
|
return $this->LibStatut($this->status,$mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the status
|
||||||
|
*
|
||||||
|
* @param int $status Id status
|
||||||
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||||
|
* @return string Label of status
|
||||||
|
*/
|
||||||
|
static function LibStatut($status,$mode=0)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
if ($mode == 0)
|
||||||
|
{
|
||||||
|
$prefix='';
|
||||||
|
if ($status == 1) return $langs->trans('Enabled');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 1)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Enabled');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 2)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
|
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 3)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
if ($mode == 4)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
|
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 5)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
if ($mode == 6)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge les informations d'ordre info dans l'objet commande
|
||||||
|
*
|
||||||
|
* @param int $id Id of order
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function info($id)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||||
|
$sql.= ' fk_user_creat, fk_user_modif';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
|
$sql.= ' WHERE t.rowid = '.$id;
|
||||||
|
$result=$this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($result))
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
if ($obj->fk_user_author)
|
||||||
|
{
|
||||||
|
$cuser = new User($this->db);
|
||||||
|
$cuser->fetch($obj->fk_user_author);
|
||||||
|
$this->user_creation = $cuser;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->fk_user_valid)
|
||||||
|
{
|
||||||
|
$vuser = new User($this->db);
|
||||||
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
|
$this->user_validation = $vuser;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->fk_user_cloture)
|
||||||
|
{
|
||||||
|
$cluser = new User($this->db);
|
||||||
|
$cluser->fetch($obj->fk_user_cloture);
|
||||||
|
$this->user_cloture = $cluser;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
|
$this->date_modification = $this->db->jdate($obj->datem);
|
||||||
|
$this->date_validation = $this->db->jdate($obj->datev);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free($result);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise object with example values
|
||||||
|
* Id must be 0 if object instance is a specimen
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initAsSpecimen()
|
||||||
|
{
|
||||||
|
$this->initAsSpecimenCommon();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action executed by scheduler
|
||||||
|
* CAN BE A CRON TASK
|
||||||
|
*
|
||||||
|
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||||
|
*/
|
||||||
|
public function doScheduledJob()
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$this->output = '';
|
||||||
|
$this->error='';
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class WebsiteAccountLine. You can also remove this and generate a CRUD class for lines objects.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
class WebsiteAccountLine
|
||||||
|
{
|
||||||
|
// @var int ID
|
||||||
|
public $id;
|
||||||
|
// @var mixed Sample line property 1
|
||||||
|
public $prop1;
|
||||||
|
// @var mixed Sample line property 2
|
||||||
|
public $prop2;
|
||||||
|
}
|
||||||
|
*/
|
||||||
@ -20,8 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file websites/websitepage.class.php
|
* \file website/websitepage.class.php
|
||||||
* \ingroup websites
|
* \ingroup website
|
||||||
* \brief File for the CRUD class of websitepage (Create/Read/Update/Delete)
|
* \brief File for the CRUD class of websitepage (Create/Read/Update/Delete)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ class WebsitePage extends CommonObject
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websiteobj->ref;
|
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websiteobj->ref;
|
||||||
|
|
||||||
$filealias=$pathofwebsite.'/'.$this->pageurl.'.php';
|
$filealias=$pathofwebsite.'/'.$this->pageurl.'.php';
|
||||||
$filetpl=$pathofwebsite.'/page'.$this->id.'.tpl.php';
|
$filetpl=$pathofwebsite.'/page'.$this->id.'.tpl.php';
|
||||||
@ -408,7 +408,7 @@ class WebsitePage extends CommonObject
|
|||||||
$label.= '<div width="100%">';
|
$label.= '<div width="100%">';
|
||||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/websites/card.php?id='.$this->id.'"';
|
$link = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
|
||||||
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
||||||
$link.= '>';
|
$link.= '>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formwebsite.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formwebsite.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -96,7 +96,7 @@ if (($pageid > 0 || $pageref) && $action != 'add')
|
|||||||
}
|
}
|
||||||
|
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website;
|
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$website;
|
||||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||||
$filecss=$pathofwebsite.'/styles.css.php';
|
$filecss=$pathofwebsite.'/styles.css.php';
|
||||||
$filejs=$pathofwebsite.'/javascript.js.php';
|
$filejs=$pathofwebsite.'/javascript.js.php';
|
||||||
@ -831,7 +831,7 @@ if ($action == 'updatemeta')
|
|||||||
$mastercontent = '<?php'."\n";
|
$mastercontent = '<?php'."\n";
|
||||||
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
|
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
|
||||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||||
//$mastercontent.= "include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';"."\n";
|
//$mastercontent.= "include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';"."\n";
|
||||||
//$mastercontent.= '$website = new WebSite($db)'."\n";
|
//$mastercontent.= '$website = new WebSite($db)'."\n";
|
||||||
$mastercontent.= '?>'."\n";
|
$mastercontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filemaster, $mastercontent);
|
$result = file_put_contents($filemaster, $mastercontent);
|
||||||
@ -1090,7 +1090,7 @@ $arrayofjs = array(
|
|||||||
);
|
);
|
||||||
$arrayofcss = array();
|
$arrayofcss = array();
|
||||||
|
|
||||||
llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', '', '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">');
|
llxHeader('', $langs->trans("websiteetup"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', '', '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">');
|
||||||
|
|
||||||
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
|
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -1151,7 +1151,7 @@ if (count($object->records) > 0)
|
|||||||
print $langs->trans("Website").': ';
|
print $langs->trans("Website").': ';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// List of websites
|
// List of website
|
||||||
print '<div class="websiteselection">';
|
print '<div class="websiteselection">';
|
||||||
$out='';
|
$out='';
|
||||||
$out.='<select name="website" class="minwidth100" id="website">';
|
$out.='<select name="website" class="minwidth100" id="website">';
|
||||||
@ -1177,14 +1177,14 @@ if (count($object->records) > 0)
|
|||||||
if ($website)
|
if ($website)
|
||||||
{
|
{
|
||||||
$virtualurl='';
|
$virtualurl='';
|
||||||
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
|
$dataroot=DOL_DATA_ROOT.'/website/'.$website;
|
||||||
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($website && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone'))
|
if ($website && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone'))
|
||||||
{
|
{
|
||||||
$disabled='';
|
$disabled='';
|
||||||
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
|
if (empty($user->rights->website->write)) $disabled=' disabled="disabled"';
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
|
|
||||||
@ -1200,12 +1200,12 @@ if (count($object->records) > 0)
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// Button for websites
|
// Button for website
|
||||||
print '<div class="websitetools">';
|
print '<div class="websitetools">';
|
||||||
|
|
||||||
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
|
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
|
||||||
{
|
{
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/website/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
@ -1217,7 +1217,7 @@ if (count($object->records) > 0)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$urlext=$virtualurl;
|
$urlext=$virtualurl;
|
||||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
$urlint=$urlwithroot.'/public/website/index.php?website='.$website;
|
||||||
print '<a class="websitebuttonsitepreview'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
print '<a class="websitebuttonsitepreview'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
@ -1296,7 +1296,7 @@ if (count($object->records) > 0)
|
|||||||
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
|
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
|
||||||
{
|
{
|
||||||
$disabled='';
|
$disabled='';
|
||||||
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
|
if (empty($user->rights->website->write)) $disabled=' disabled="disabled"';
|
||||||
|
|
||||||
// Confirmation to clone
|
// Confirmation to clone
|
||||||
if ($action == 'createfromclone') {
|
if ($action == 'createfromclone') {
|
||||||
@ -1351,7 +1351,7 @@ if (count($object->records) > 0)
|
|||||||
$websitepage = new WebSitePage($db);
|
$websitepage = new WebSitePage($db);
|
||||||
$websitepage->fetch($pageid);
|
$websitepage->fetch($pageid);
|
||||||
|
|
||||||
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&pageref='.$websitepage->pageurl;
|
$realpage=$urlwithroot.'/public/website/index.php?website='.$website.'&pageref='.$websitepage->pageurl;
|
||||||
$pagealias = $websitepage->pageurl;
|
$pagealias = $websitepage->pageurl;
|
||||||
|
|
||||||
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
|
||||||
@ -1365,7 +1365,7 @@ if (count($object->records) > 0)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$urlext=$virtualurl.'/'.$pagealias.'.php';
|
$urlext=$virtualurl.'/'.$pagealias.'.php';
|
||||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
$urlint=$urlwithroot.'/public/website/index.php?website='.$website;
|
||||||
print '<a class="websitebuttonsitepreview'.($virtualurl?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
|
print '<a class="websitebuttonsitepreview'.($virtualurl?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $virtualurl?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $virtualurl?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
@ -1414,7 +1414,7 @@ if (count($object->records) > 0)
|
|||||||
url: "'.DOL_URL_ROOT.'/core/ajax/saveinplace.php",
|
url: "'.DOL_URL_ROOT.'/core/ajax/saveinplace.php",
|
||||||
data: {
|
data: {
|
||||||
field: \'editval_virtualhost\',
|
field: \'editval_virtualhost\',
|
||||||
element: \'websites\',
|
element: \'website\',
|
||||||
table_element: \'website\',
|
table_element: \'website\',
|
||||||
fk_element: '.$object->id.',
|
fk_element: '.$object->id.',
|
||||||
value: newurl,
|
value: newurl,
|
||||||
@ -1575,7 +1575,7 @@ if ($action == 'createsite')
|
|||||||
/*$h = 0;
|
/*$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = dol_buildpath('/websites/index.php',1).'?id='.$object->id;
|
$head[$h][0] = dol_buildpath('/website/index.php',1).'?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("AddSite");
|
$head[$h][1] = $langs->trans("AddSite");
|
||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
@ -1605,7 +1605,7 @@ if ($action == 'createsite')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->textwithpicto($langs->trans('Virtualhost'), $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'), 1, 'help', '', 0, 2, 'tooltipvirtual');
|
print $form->textwithpicto($langs->trans('Virtualhost'), $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>'), 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="flat minwidth300" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">';
|
print '<input type="text" class="flat minwidth300" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1642,7 +1642,7 @@ if ($action == 'editmeta' || $action == 'create')
|
|||||||
/*$h = 0;
|
/*$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = dol_buildpath('/websites/index.php',1).'?id='.$object->id;
|
$head[$h][0] = dol_buildpath('/website/index.php',1).'?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("AddPage");
|
$head[$h][1] = $langs->trans("AddPage");
|
||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
@ -1686,7 +1686,7 @@ if ($action == 'editmeta' || $action == 'create')
|
|||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('WEBSITE_PAGEURL');
|
print $langs->trans('WEBSITE_PAGEURL');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '/public/websites/index.php?website='.urlencode($website).'&pageid='.urlencode($pageid);
|
print '/public/website/index.php?website='.urlencode($website).'&pageid='.urlencode($pageid);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1875,7 +1875,7 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
|
|||||||
//include_once $original_file_osencoded;
|
//include_once $original_file_osencoded;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*print '<iframe class="websiteiframenoborder centpercent" src="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'&pageid='.$pageid.'"/>';
|
/*print '<iframe class="websiteiframenoborder centpercent" src="'.DOL_URL_ROOT.'/public/website/index.php?website='.$website.'&pageid='.$pageid.'"/>';
|
||||||
print '</iframe>';*/
|
print '</iframe>';*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1913,7 +1913,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
|
|||||||
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
|
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
|
||||||
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
|
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
|
||||||
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
|
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
|
||||||
$aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
|
$aliascontent.= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
|
||||||
$aliascontent.= '?>'."\n";
|
$aliascontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filealias, $aliascontent);
|
$result = file_put_contents($filealias, $aliascontent);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@ -1965,7 +1965,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
|||||||
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
||||||
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
||||||
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
|
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
|
||||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/website/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
||||||
$tplcontent.= '<!-- Include HTML header from page inline block -->'."\n";
|
$tplcontent.= '<!-- Include HTML header from page inline block -->'."\n";
|
||||||
$tplcontent.= $objectpage->htmlheader."\n";
|
$tplcontent.= $objectpage->htmlheader."\n";
|
||||||
$tplcontent.= '</head>'."\n";
|
$tplcontent.= '</head>'."\n";
|
||||||
Loading…
Reference in New Issue
Block a user