mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Work on website module
This commit is contained in:
parent
458be3c814
commit
a346a1a5e9
|
|
@ -5263,7 +5263,7 @@ abstract class CommonObject
|
|||
* Return HTML string to show a field into a page
|
||||
* Code very similar with showOutputField of extra fields
|
||||
*
|
||||
* @param array $val Array of properties for field to show
|
||||
* @param array $val Array of properties of field to show
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||
* @param string $moreparam To add more parametes on html input tag
|
||||
|
|
@ -5283,7 +5283,6 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$objectid = $this->id;
|
||||
|
||||
$label=$val['label'];
|
||||
$type =$val['type'];
|
||||
$size =$val['css'];
|
||||
|
|
@ -5307,8 +5306,8 @@ abstract class CommonObject
|
|||
}
|
||||
$langfile=$val['langfile'];
|
||||
$list=$val['list'];
|
||||
$hidden=(abs($val['visible'])!=1 ? 1 : 0);
|
||||
$help=$val['help'];
|
||||
$hidden=(($val['visible'] == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
|
||||
if ($hidden) return '';
|
||||
|
||||
|
|
@ -5320,21 +5319,37 @@ abstract class CommonObject
|
|||
$value = dol_eval($computed, 1, 0);
|
||||
}
|
||||
|
||||
$showsize=0;
|
||||
if ($type == 'date')
|
||||
if (empty($showsize))
|
||||
{
|
||||
if ($type == 'date')
|
||||
{
|
||||
$showsize=10;
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
{
|
||||
$showsize=19;
|
||||
}
|
||||
elseif ($type == 'int' || $type == 'integer')
|
||||
{
|
||||
$showsize=10;
|
||||
}
|
||||
else
|
||||
{
|
||||
$showsize=round($size);
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
}
|
||||
|
||||
if ($key == 'ref') $value=$this->getNomUrl(1, '', 0, '', 1);
|
||||
elseif ($key == 'status') $value=$this->getLibStatut(3);
|
||||
elseif ($type == 'date')
|
||||
{
|
||||
$showsize=10;
|
||||
$value=dol_print_date($value,'day');
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
{
|
||||
$showsize=19;
|
||||
$value=dol_print_date($value,'dayhour');
|
||||
}
|
||||
elseif ($type == 'int')
|
||||
{
|
||||
$showsize=10;
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
{
|
||||
if (!empty($value)) {
|
||||
|
|
@ -5569,11 +5584,6 @@ abstract class CommonObject
|
|||
{
|
||||
$value=preg_replace('/./i','*',$value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$showsize=round($size);
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
|
||||
//print $type.'-'.$size;
|
||||
$out=$value;
|
||||
|
|
|
|||
|
|
@ -1315,7 +1315,7 @@ class ExtraFields
|
|||
*
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show
|
||||
* @param string $moreparam To add more parametes on html input tag (only checkbox use html input for output rendering)
|
||||
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
|
||||
* @return string Formated value
|
||||
*/
|
||||
function showOutputField($key,$value,$moreparam='')
|
||||
|
|
@ -1334,7 +1334,7 @@ class ExtraFields
|
|||
$perms=$this->attribute_perms[$key];
|
||||
$langfile=$this->attribute_langfile[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=(abs($list)!=1 ? 1 : 0);
|
||||
$hidden=(($list != 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
|
||||
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
|
||||
|
||||
|
|
|
|||
|
|
@ -209,10 +209,10 @@ function societe_prepare_head(Societe $object)
|
|||
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");
|
||||
$head[$h][1] = $langs->trans("WebSiteAccounts");
|
||||
$nbNote = 0;
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as n";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."website_account as n";
|
||||
$sql.= " WHERE fk_soc = ".$object->id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@
|
|||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (abs($val['visible']) != 1) continue; // Discard such field from form
|
||||
// Discard if extrafield is a hidden field on form
|
||||
if (abs($val['visible']) != 1) continue;
|
||||
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
|
||||
if ($key == 'status') continue; // Status is alreadt in dol_banner
|
||||
if ($key == 'status') continue; // Status is already in dol_banner
|
||||
|
||||
$value=$object->$key;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
|||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Discard if extrafield is a hidden field
|
||||
// Discard if extrafield is a hidden field on form
|
||||
if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue;
|
||||
|
||||
// Load language if required
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
|
|||
|
||||
-- For 7.0
|
||||
|
||||
UPDATE llx_website SET entity = 1 WHERE entity IS NULL;
|
||||
-- VMYSQL4.3 ALTER TABLE llx_website MODIFY COLUMN entity integer NOT NULL DEFAULT 1;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_website ALTER COLUMN entity SET NOT NULL;
|
||||
|
||||
ALTER TABLE llx_user ADD COLUMN birth date;
|
||||
|
||||
-- VMYSQL4.1 ALTER TABLE llx_holiday_users DROP PRIMARY KEY;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
CREATE TABLE llx_website
|
||||
(
|
||||
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
entity integer DEFAULT 1,
|
||||
entity integer NOT NULL DEFAULT 1,
|
||||
ref varchar(128) NOT NULL,
|
||||
description varchar(255),
|
||||
status integer DEFAULT 1,
|
||||
|
|
|
|||
|
|
@ -815,6 +815,7 @@ BulkActions=Bulk actions
|
|||
ClickToShowHelp=Click to show tooltip help
|
||||
WebSite=Web site
|
||||
WebSites=Web sites
|
||||
WebSiteAccounts=Web site accounts
|
||||
ExpenseReport=Expense report
|
||||
ExpenseReports=Expense reports
|
||||
HR=HR
|
||||
|
|
|
|||
|
|
@ -488,12 +488,10 @@ while ($i < min($num, $limit))
|
|||
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 $object->getNomUrl(1, '', 0, '', 1);
|
||||
elseif ($key == 'status') print $object->getLibStatut(3);
|
||||
else print $obj->$key;
|
||||
print '<td';
|
||||
if ($align) print ' class="'.$align.'"';
|
||||
print '>';
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
|
|
@ -510,12 +508,12 @@ while ($i < min($num, $limit))
|
|||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print '<td';
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ $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";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."website_account 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->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")";
|
||||
else $sql.=" WHERE 1 = 1";
|
||||
|
|
@ -488,12 +488,11 @@ while ($i < min($num, $limit))
|
|||
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' || $key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
|
||||
elseif ($key == 'status') print $objectwebsiteaccount->getLibStatut(3);
|
||||
else print $obj->$key;
|
||||
print '<td';
|
||||
if ($align) print ' class="'.$align.'"';
|
||||
print '>';
|
||||
if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
|
||||
else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
|
|
@ -510,12 +509,12 @@ while ($i < min($num, $limit))
|
|||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print '<td';
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
|
|
|
|||
|
|
@ -44,7 +44,11 @@ class Website extends CommonObject
|
|||
*/
|
||||
public $table_element = 'website';
|
||||
/**
|
||||
* @var string String with name of icon for websiteaccount. Must be the part after the 'object_' into object_myobject.png
|
||||
* @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 1;
|
||||
/**
|
||||
* @var string String with name of icon for website. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'globe';
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class WebsiteAccount extends CommonObject
|
|||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
|
||||
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',),
|
||||
'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>-1, 'enabled'=>1, 'position'=>30),
|
||||
'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>-2, 'enabled'=>1, 'position'=>30),
|
||||
'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1),
|
||||
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
|
||||
|
|
@ -117,11 +117,11 @@ class WebsiteAccount extends CommonObject
|
|||
/**
|
||||
* @var int Name of subtable line
|
||||
*/
|
||||
//public $table_element_line = 'websiteaccountdet';
|
||||
//public $table_element_line = 'website_accountdet';
|
||||
/**
|
||||
* @var int Field with ID of parent key if this field has a parent
|
||||
*/
|
||||
//public $fk_element = 'fk_websiteaccount';
|
||||
//public $fk_element = 'fk_website_account';
|
||||
/**
|
||||
* @var int Name of subtable class that manage subtable lines
|
||||
*/
|
||||
|
|
@ -129,7 +129,7 @@ class WebsiteAccount extends CommonObject
|
|||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
*/
|
||||
//protected $childtables=array('websiteaccountdet');
|
||||
//protected $childtables=array('website_accountdet');
|
||||
/**
|
||||
* @var WebsiteAccountLine[] Array of subtable lines
|
||||
*/
|
||||
|
|
@ -319,12 +319,11 @@ class WebsiteAccount extends CommonObject
|
|||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
}
|
||||
$result.= $linkstart . $this->ref . $linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class WebsitePage extends CommonObject
|
|||
*/
|
||||
public $table_element = 'website_page';
|
||||
/**
|
||||
* @var string String with name of icon for websiteaccount. Must be the part after the 'object_' into object_myobject.png
|
||||
* @var string String with name of icon for websitepage. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'label';
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ function websiteaccountPrepareHead($object)
|
|||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
||||
/*if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
||||
{
|
||||
$nbNote = 0;
|
||||
if(!empty($object->fields['note_private'])) $nbNote++;
|
||||
|
|
@ -51,7 +51,7 @@ function websiteaccountPrepareHead($object)
|
|||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user