Merge remote-tracking branch 'uptream/develop' into 7.0-accountancyproductvariant

# Conflicts:
#	htdocs/install/mysql/migration/6.0.0-7.0.0.sql
This commit is contained in:
Alexandre SPANGARO 2017-11-04 07:14:28 +01:00
commit 7e3103356b
43 changed files with 389 additions and 156 deletions

View File

@ -0,0 +1,62 @@
<VirtualHost *:80>
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/../htdocs
ServerName myvirtualalias
ServerAlias myvirtualalias
UseCanonicalName On
AddDefaultCharset UTF-8
DocumentRoot "/home/.../htdocs"
<Directory /home/.../htdocs/>
AllowOverride None
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
Require all granted
</Directory>
<Directory "/home/../htdocs/cache">
Deny from all
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
</Directory>
ErrorLog /var/log/apache2/myvirtualalias_error_log
TransferLog /var/log/apache2/myvirtualalias_access_log
# Compress returned resources of type php pages, text file export, css and javascript
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
AddType text/javascript .jgz
AddEncoding gzip .jgz
ExpiresActive On
ExpiresByType image/x-icon A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
SSLEngine On
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
#RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</VirtualHost>

View File

@ -53,11 +53,19 @@ print '<tr class="oddeven"><td>'.$langs->trans("IP")."</td><td>".$_SERVER["SERVE
print '<tr><td>'.$langs->trans("Port")."</td><td>" . $_SERVER["SERVER_PORT"] . "</td></tr>\n"; print '<tr><td>'.$langs->trans("Port")."</td><td>" . $_SERVER["SERVER_PORT"] . "</td></tr>\n";
print '<tr><td>'.$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n"; print '<tr><td>'.$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n";
print '<tr><td>'.$langs->trans("DataRootServer")."</td><td>" . DOL_DATA_ROOT . "</td></tr>\n"; print '<tr><td>'.$langs->trans("DataRootServer")."</td><td>" . DOL_DATA_ROOT . "</td></tr>\n";
// Web user group by default
$labeluser=dol_getwebuser('user'); $labeluser=dol_getwebuser('user');
$labelgroup=dol_getwebuser('group'); $labelgroup=dol_getwebuser('group');
if ($labeluser && $labelgroup) if ($labeluser && $labelgroup)
{ {
print '<tr><td>'.$langs->trans("WebUserGroup")."</td><td>".$labeluser.'/'.$labelgroup."</td></tr>\n"; print '<tr><td>'.$langs->trans("WebUserGroup")." (env vars)</td><td>".$labeluser.'/'.$labelgroup."</td></tr>\n";
}
// Web user group real (detected by 'id' external command)
$arrayout=array(); $varout=0;
exec('id', $arrayout, $varout);
if (empty($varout)) // Test command is ok. Work only on Linux OS.
{
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>".join(',', $arrayout)."</td></tr>\n";
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -766,12 +766,10 @@ class Categorie extends CommonObject
// For backward compatibility // For backward compatibility
if ($type == 'societe') { if ($type == 'societe') {
$type = 'customer'; $type = 'customer';
dol_syslog( get_class( $this ) . "::del_type(): type 'societe' is deprecated, please use 'customer' instead", dol_syslog( get_class( $this ) . "::del_type(): type 'societe' is deprecated, please use 'customer' instead", LOG_WARNING);
LOG_WARNING );
} elseif ($type == 'fournisseur') { } elseif ($type == 'fournisseur') {
$type = 'supplier'; $type = 'supplier';
dol_syslog( get_class( $this ) . "::del_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", dol_syslog( get_class( $this ) . "::del_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", LOG_WARNING);
LOG_WARNING );
} }
$this->db->begin(); $this->db->begin();

View File

@ -88,13 +88,13 @@ if ($id > 0 && $removeelem > 0)
{ {
$tmpobject = new Societe($db); $tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'fournisseur'; $elementtype = 'supplier';
} }
else if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) else if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
{ {
$tmpobject = new Societe($db); $tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'societe'; $elementtype = 'customer';
} }
else if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) else if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
{ {

View File

@ -177,7 +177,7 @@ if (count($object->records) > 0)
// ***** Part for web sites // ***** Part for web sites
print '<div class="websiteselection hideonsmartphoneimp">'; print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Website").': '; print $langs->trans("WebSite").': ';
print '</div>'; print '</div>';
// List of websites // List of websites

View File

@ -1541,7 +1541,7 @@ class ActionComm extends CommonObject
// Delete also very old past events (we do not keep more than 1 month record in past) // Delete also very old past events (we do not keep more than 1 month record in past)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->jdate($now - (3600 * 24 * 32))."'"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'";
$this->db->query($sql); $this->db->query($sql);
return 0; return 0;

View File

@ -224,6 +224,8 @@ if ($object->fetch($id) >= 0)
dol_fiche_end(); dol_fiche_end();
print '<br>';
$allowaddtarget=($object->statut == 0); $allowaddtarget=($object->statut == 0);

View File

@ -87,6 +87,7 @@ if ($action == 'update' && ! empty($permissiontoadd))
{ {
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
if (! GETPOSTISSET($key)) continue; // The field was not submited to be edited
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
$value = GETPOST($key,'alpha'); $value = GETPOST($key,'alpha');

View File

@ -1396,7 +1396,7 @@ abstract class CommonObject
} }
/** /**
* Load properties id_previous and id_next * Load properties id_previous and id_next by comparing $fieldid with $this->ref
* *
* @param string $filter Optional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')" * @param string $filter Optional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')"
* @param string $fieldid Name of field to use for the select MAX and MIN * @param string $fieldid Name of field to use for the select MAX and MIN
@ -1433,7 +1433,7 @@ abstract class CommonObject
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 == 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 = '.$filter.' -> '.$sql."<br>";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if (! $result) if (! $result)
{ {
@ -5263,7 +5263,7 @@ abstract class CommonObject
* Return HTML string to show a field into a page * Return HTML string to show a field into a page
* Code very similar with showOutputField of extra fields * 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 $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 $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 * @param string $moreparam To add more parametes on html input tag
@ -5283,7 +5283,6 @@ abstract class CommonObject
} }
$objectid = $this->id; $objectid = $this->id;
$label=$val['label']; $label=$val['label'];
$type =$val['type']; $type =$val['type'];
$size =$val['css']; $size =$val['css'];
@ -5307,8 +5306,8 @@ abstract class CommonObject
} }
$langfile=$val['langfile']; $langfile=$val['langfile'];
$list=$val['list']; $list=$val['list'];
$hidden=(abs($val['visible'])!=1 ? 1 : 0);
$help=$val['help']; $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 ''; if ($hidden) return '';
@ -5320,21 +5319,37 @@ abstract class CommonObject
$value = dol_eval($computed, 1, 0); $value = dol_eval($computed, 1, 0);
} }
$showsize=0; if (empty($showsize))
{
if ($type == 'date') if ($type == 'date')
{ {
$showsize=10; $showsize=10;
$value=dol_print_date($value,'day');
} }
elseif ($type == 'datetime') elseif ($type == 'datetime')
{ {
$showsize=19; $showsize=19;
$value=dol_print_date($value,'dayhour');
} }
elseif ($type == 'int') elseif ($type == 'int' || $type == 'integer')
{ {
$showsize=10; $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')
{
$value=dol_print_date($value,'day');
}
elseif ($type == 'datetime')
{
$value=dol_print_date($value,'dayhour');
}
elseif ($type == 'double') elseif ($type == 'double')
{ {
if (!empty($value)) { if (!empty($value)) {
@ -5569,11 +5584,6 @@ abstract class CommonObject
{ {
$value=preg_replace('/./i','*',$value); $value=preg_replace('/./i','*',$value);
} }
else
{
$showsize=round($size);
if ($showsize > 48) $showsize=48;
}
//print $type.'-'.$size; //print $type.'-'.$size;
$out=$value; $out=$value;
@ -6034,7 +6044,7 @@ abstract class CommonObject
} }
/** /**
* Function to load data into current object this * Function to load data from a SQL pointer into properties of current object $this
* *
* @param stdClass $obj Contain data of object from database * @param stdClass $obj Contain data of object from database
*/ */
@ -6072,8 +6082,10 @@ abstract class CommonObject
{ {
$this->{$field} = $obj->{$field}; $this->{$field} = $obj->{$field};
} }
} }
// If there is no 'ref' field, we force property ->ref to ->id for a better compatibility with common functions.
if (! isset($this->fields['ref']) && isset($this->id)) $this->ref = $this->id;
} }
/** /**

View File

@ -1315,7 +1315,7 @@ class ExtraFields
* *
* @param string $key Key of attribute * @param string $key Key of attribute
* @param string $value Value to show * @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 * @return string Formated value
*/ */
function showOutputField($key,$value,$moreparam='') function showOutputField($key,$value,$moreparam='')
@ -1334,7 +1334,7 @@ class ExtraFields
$perms=$this->attribute_perms[$key]; $perms=$this->attribute_perms[$key];
$langfile=$this->attribute_langfile[$key]; $langfile=$this->attribute_langfile[$key];
$list=$this->attribute_list[$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. if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.

View File

@ -6158,13 +6158,13 @@ class Form
/** /**
* Return a HTML area with the reference of object and a navigation bar for a business object * Return a HTML area with the reference of object and a navigation bar for a business object
* Note: To add a particular filter on select, you can have $object->next_prev_filter set to add SQL criterias. * Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criterias.
* *
* @param object $object Object to show. * @param object $object Object to show.
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link. * @param string $paramid Name of parameter to use to name the id into the URL next/previous link.
* @param string $morehtml More html content to output just before the nav bar. * @param string $morehtml More html content to output just before the nav bar.
* @param int $shownav Show Condition (navigation is shown if value is 1). * @param int $shownav Show Condition (navigation is shown if value is 1).
* @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field). Use 'none' to disable next/prev. * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field compared to $object->ref). Use 'none' to disable next/prev.
* @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref. * @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref.
* @param string $morehtmlref More html to show after ref. * @param string $morehtmlref More html to show after ref.
* @param string $moreparam More param to add in nav link url. Must start with '&...'. * @param string $moreparam More param to add in nav link url. Must start with '&...'.
@ -6194,7 +6194,7 @@ class Form
if ($shownav) if ($shownav)
{ {
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''), $fieldid, $nodbprefix);
$navurl = $_SERVER["PHP_SELF"]; $navurl = $_SERVER["PHP_SELF"];
// Special case for project/task page // Special case for project/task page

View File

@ -209,10 +209,10 @@ function societe_prepare_head(Societe $object)
if (! empty($conf->website->enabled) && (!empty($user->rights->societe->lire) )) if (! empty($conf->website->enabled) && (!empty($user->rights->societe->lire) ))
{ {
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.$object->id; $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; $nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb"; $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; $sql.= " WHERE fk_soc = ".$object->id;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -389,7 +389,7 @@ function societe_admin_prepare_head()
* Return country label, code or id from an id, code or label * Return country label, code or id from an id, code or label
* *
* @param int $searchkey Id or code of country to search * @param int $searchkey Id or code of country to search
* @param int $withcode '0'=Return label, * @param string $withcode '0'=Return label,
* '1'=Return code + label, * '1'=Return code + label,
* '2'=Return code from id, * '2'=Return code from id,
* '3'=Return id from code, * '3'=Return id from code,
@ -400,7 +400,7 @@ function societe_admin_prepare_head()
* @param int $searchlabel Label of country to search (warning: searching on label is not reliable) * @param int $searchlabel Label of country to search (warning: searching on label is not reliable)
* @return mixed String with country code or translated country name or Array('id','code','label') * @return mixed String with country code or translated country name or Array('id','code','label')
*/ */
function getCountry($searchkey,$withcode='',$dbtouse=0,$outputlangs='',$entconv=1,$searchlabel='') function getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
{ {
global $db,$langs; global $db,$langs;

View File

@ -598,9 +598,9 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip) * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip)
* @return array Array of substitutions * @return array Array of substitutions
*/ */
function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykeys=0) function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
{ {
$substitutionarray = getCommonSubstitutionArray($outputlangs, $onlykeys, $exclude, $object); $substitutionarray = getCommonSubstitutionArray($outputlangs, $onlykey, $exclude, $object);
$substitutionarray['__FROM_NAME__']='__FROM_NAME__'; $substitutionarray['__FROM_NAME__']='__FROM_NAME__';
$substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__'; $substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__';
return $substitutionarray; return $substitutionarray;

View File

@ -74,24 +74,24 @@ function dol_decode($chain)
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
* *
* @param string $chain String to hash * @param string $chain String to hash
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5, 4:md5 for OpenLdap). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0. * @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @return string Hash of string * @return string Hash of string
*/ */
function dol_hash($chain,$type=0) function dol_hash($chain, $type='0')
{ {
global $conf; global $conf;
// Salt value // Salt value
if (! empty($conf->global->MAIN_SECURITY_SALT)) $chain=$conf->global->MAIN_SECURITY_SALT.$chain; if (! empty($conf->global->MAIN_SECURITY_SALT)) $chain=$conf->global->MAIN_SECURITY_SALT.$chain;
if ($type == 1) return sha1($chain); if ($type == '1' || $type == 'sha1') return sha1($chain);
else if ($type == 2) return sha1(md5($chain)); else if ($type == '2' || $type == 'sha1md5') return sha1(md5($chain));
else if ($type == 3) return md5($chain); else if ($type == '3' || $type == 'md5') return md5($chain);
else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5 (based on an unencrypted password in base) else if ($type == '4' || $type == 'md5openldap') return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5 (based on an unencrypted password in base)
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain)); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));
// No particular enconding defined, use default // No particular encoding defined, use default
return md5($chain); return md5($chain);
} }

View File

@ -439,7 +439,7 @@ function encodedecode_dbpassconf($level=0)
/** /**
* Return a generated password using default module * Return a generated password using default module
* *
* @param boolean $generic true=Create generic password (use md5, sha1 depending on setup), false=Use the configured password generation module * @param boolean $generic true=Create generic password (32 chars/numbers), false=Use the configured password generation module
* @return string New value for password * @return string New value for password
*/ */
function getRandomPassword($generic=false) function getRandomPassword($generic=false)
@ -447,7 +447,48 @@ function getRandomPassword($generic=false)
global $db,$conf,$langs,$user; global $db,$conf,$langs,$user;
$generated_password=''; $generated_password='';
if ($generic) $generated_password=dol_hash(mt_rand()); if ($generic)
{
$length = 32;
$lowercase = "qwertyuiopasdfghjklzxcvbnm";
$uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
$numbers = "1234567890";
$randomCode = "";
if (function_exists('random_int')) // Cryptographic random
{
$max = strlen($lowercase) - 1;
for ($x = 0; $x < abs($length/3); $x++) {
$randomCode .= $lowercase{random_int(0, $max)};
}
$max = strlen($uppercase) - 1;
for ($x = 0; $x < abs($length/3); $x++) {
$randomCode .= $uppercase{random_int(0, $max)};
}
$max = strlen($numbers) - 1;
for ($x = 0; $x < abs($length/3); $x++) {
$randomCode .= $numbers{random_int(0, $max)};
}
$generated_password=str_shuffle($randomCode);
}
else // Old platform, non cryptographic random
{
$max = strlen($lowercase) - 1;
for ($x = 0; $x < abs($length/3); $x++) {
$randomCode .= $lowercase{mt_rand(0, $max)};
}
$max = strlen($uppercase) - 1;
for ($x = 0; $x < abs($length/3); $x++) {
$randomCode .= $uppercase{mt_rand(0, $max)};
}
$max = strlen($numbers) - 1;
for ($x = 0; $x < abs($length/3); $x++) {
$randomCode .= $numbers{mt_rand(0, $max)};
}
$generated_password=str_shuffle($randomCode);
}
}
else if (! empty($conf->global->USER_PASSWORD_GENERATED)) else if (! empty($conf->global->USER_PASSWORD_GENERATED))
{ {
$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED); $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);

View File

@ -116,12 +116,13 @@ if ($action == 'presend')
} }
$formmail->withfrom = 1; $formmail->withfrom = 1;
// Fill list of recipient with email inside <>.
$liste = array(); $liste = array();
if ($object->element == 'expensereport') if ($object->element == 'expensereport')
{ {
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($object->fk_user_author); $fuser->fetch($object->fk_user_author);
$liste['thirdparty'] = $fuser->getFullName($langs)." &lt;".$fuser->email."&gt;"; $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
} }
elseif ($object->element == 'societe') elseif ($object->element == 'societe')
{ {
@ -131,7 +132,7 @@ if ($action == 'presend')
} }
elseif ($object->element == 'user' || $object->element == 'member') elseif ($object->element == 'user' || $object->element == 'member')
{ {
$liste['thirdparty'] = $object->getFullName($langs)." &lt;".$object->email."&gt;"; $liste['thirdparty'] = $object->getFullName($langs)." <".$object->email.">";
} }
else else
{ {

View File

@ -26,7 +26,9 @@
foreach($object->fields as $key => $val) 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 (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
print '<tr id="field_'.$key.'">'; print '<tr id="field_'.$key.'">';

View File

@ -26,7 +26,9 @@
foreach($object->fields as $key => $val) 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 (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
print '<tr><td'; print '<tr><td';

View File

@ -26,9 +26,11 @@
foreach($object->fields as $key => $val) 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 (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; $value=$object->$key;

View File

@ -42,7 +42,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
{ {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) 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; if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue;
// Load language if required // Load language if required

View File

@ -48,13 +48,11 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
{ {
if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Test if event/record is qualified // Test if event/record is qualified
$listofqualifiedelement = array('payment', 'facture'); $listofqualifiedelement = array('payment', 'facture');
if (! in_array($object->element, $listofqualifiedelement)) return 1; if (! in_array($object->element, $listofqualifiedelement)) return 1;
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Event/record is qualified // Event/record is qualified
if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'

View File

@ -1121,7 +1121,7 @@ class Cronjob extends CommonObject
$error++; $error++;
} }
} }
if ($execmethod == 2) // This method may create if ($execmethod == 2) // With this method, there is no way to get the return code, only output
{ {
$ok=0; $ok=0;
$handle = fopen($outputfile, 'w+b'); $handle = fopen($outputfile, 'w+b');
@ -1154,7 +1154,7 @@ class Cronjob extends CommonObject
dol_syslog(get_class($this)."::executeCLI output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG); dol_syslog(get_class($this)."::executeCLI output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
return $reval; return $retval;
} }

View File

@ -63,6 +63,10 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
-- For 7.0 -- 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; ALTER TABLE llx_user ADD COLUMN birth date;
-- VMYSQL4.1 ALTER TABLE llx_holiday_users DROP PRIMARY KEY; -- VMYSQL4.1 ALTER TABLE llx_holiday_users DROP PRIMARY KEY;
@ -173,13 +177,26 @@ ALTER TABLE llx_menu MODIFY fk_mainmenu varchar(100);
ALTER TABLE llx_menu MODIFY fk_leftmenu varchar(100); ALTER TABLE llx_menu MODIFY fk_leftmenu varchar(100);
CREATE TABLE llx_websiteaccount( CREATE TABLE llx_website_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_website_extrafields ADD INDEX idx_website_extrafields (fk_object);
CREATE TABLE llx_website_account(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
login varchar(64) NOT NULL, login varchar(64) NOT NULL,
pass_encoding varchar(24) NOT NULL,
pass_crypted varchar(128), pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password pass_temp varchar(128), -- temporary password when asked for forget password
fk_soc integer, fk_soc integer,
fk_website integer, fk_website integer NOT NULL,
note_private text,
date_last_login datetime, date_last_login datetime,
date_previous_login datetime, date_previous_login datetime,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
@ -191,13 +208,17 @@ CREATE TABLE llx_websiteaccount(
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid); ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login); ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_import_key (import_key); ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status); ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc); ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc);
create table llx_websiteaccount_extrafields ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc);
ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
CREATE TABLE llx_website_account_extrafields
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, tms timestamp,
@ -205,11 +226,16 @@ create table llx_websiteaccount_extrafields
import_key varchar(14) -- import key import_key varchar(14) -- import key
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_website_account_extrafields ADD INDEX idx_website_account_extrafields (fk_object);
alter table llx_user add column pass_encoding varchar(24) NULL;
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,
@ -498,7 +524,7 @@ ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_intra varchar(32) AFTER accountancy_code_sell; ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_intra varchar(32) AFTER accountancy_code_sell;
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra; ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra;
-- SPEC : use database type "double" to store monetary values -- SPEC : use database type 'double' to store monetary values
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8); ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8); ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8); ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8);

View File

@ -34,6 +34,7 @@ create table llx_user
fk_user_creat integer, fk_user_creat integer,
fk_user_modif integer, fk_user_modif integer,
login varchar(50) NOT NULL, login varchar(50) NOT NULL,
pass_encoding varchar(24);
pass varchar(128), pass varchar(128),
pass_crypted varchar(128), pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password pass_temp varchar(128), -- temporary password when asked for forget password

View File

@ -20,7 +20,7 @@
CREATE TABLE llx_website CREATE TABLE llx_website
( (
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
entity integer DEFAULT 1, entity integer NOT NULL DEFAULT 1,
ref varchar(128) NOT NULL, ref varchar(128) NOT NULL,
description varchar(255), description varchar(255),
status integer DEFAULT 1, status integer DEFAULT 1,

View File

@ -15,14 +15,14 @@
-- BEGIN MODULEBUILDER INDEXES -- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid); ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login); ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status); ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_website (fk_website); ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc); ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc);
-- END MODULEBUILDER INDEXES -- END MODULEBUILDER INDEXES
ALTER TABLE llx_websiteaccount ADD UNIQUE INDEX uk_websiteaccount_login_website_soc(login, fk_website, fk_soc); ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc);
--ALTER TABLE llx_websiteaccount ADD CONSTRAINT llx_websiteaccount_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid); ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);

View File

@ -14,14 +14,16 @@
-- along with this program. If not, see http://www.gnu.org/licenses/. -- along with this program. If not, see http://www.gnu.org/licenses/.
CREATE TABLE llx_websiteaccount( CREATE TABLE llx_website_account(
-- BEGIN MODULEBUILDER FIELDS -- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
login varchar(64) NOT NULL, login varchar(64) NOT NULL,
pass_encoding varchar(24) NOT NULL,
pass_crypted varchar(128), pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password pass_temp varchar(128), -- temporary password when asked for forget password
fk_soc integer, fk_soc integer,
fk_website integer, fk_website integer NOT NULL,
note_private text,
date_last_login datetime, date_last_login datetime,
date_previous_login datetime, date_previous_login datetime,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_website_account_extrafields ADD INDEX idx_website_account_extrafields (fk_object);

View File

@ -0,0 +1,23 @@
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see http://www.gnu.org/licenses/.
CREATE TABLE llx_website_account_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_website_extrafields ADD INDEX idx_website_extrafields (fk_object);

View File

@ -1,4 +1,4 @@
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
@ -13,7 +13,7 @@
-- You should have received a copy of the GNU General Public License -- You should have received a copy of the GNU General Public License
-- along with this program. If not, see http://www.gnu.org/licenses/. -- along with this program. If not, see http://www.gnu.org/licenses/.
create table llx_websiteaccount_extrafields CREATE TABLE llx_website_extrafields
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, tms timestamp,

View File

@ -813,8 +813,9 @@ ModuleBuilder=Module Builder
SetMultiCurrencyCode=Set currency SetMultiCurrencyCode=Set currency
BulkActions=Bulk actions BulkActions=Bulk actions
ClickToShowHelp=Click to show tooltip help ClickToShowHelp=Click to show tooltip help
Website=Web site WebSite=Web site
WebSites=Web sites WebSites=Web sites
WebSiteAccounts=Web site accounts
ExpenseReport=Expense report ExpenseReport=Expense report
ExpenseReports=Expense reports ExpenseReports=Expense reports
HR=HR HR=HR
@ -823,7 +824,6 @@ AutomaticallyCalculated=Automatically calculated
TitleSetToDraft=Go back to draft TitleSetToDraft=Go back to draft
ConfirmSetToDraft=Are you sure you want to go back to Draft status ? ConfirmSetToDraft=Are you sure you want to go back to Draft status ?
ImportId=Import id ImportId=Import id
Websites=Web sites
Events=Events Events=Events
EMailTemplates=Emails templates EMailTemplates=Emails templates
FileNotShared=File not shared to exernal public FileNotShared=File not shared to exernal public

View File

@ -214,6 +214,7 @@ StartUpload=Start upload
CancelUpload=Cancel upload CancelUpload=Cancel upload
FileIsTooBig=Files is too big FileIsTooBig=Files is too big
PleaseBePatient=Please be patient... PleaseBePatient=Please be patient...
ResetPassword=Reset password
RequestToResetPasswordReceived=A request to change your Dolibarr password has been received RequestToResetPasswordReceived=A request to change your Dolibarr password has been received
NewKeyIs=This is your new keys to login NewKeyIs=This is your new keys to login
NewKeyWillBe=Your new key to login to software will be NewKeyWillBe=Your new key to login to software will be
@ -223,6 +224,7 @@ ForgetIfNothing=If you didn't request this change, just forget this email. Your
IfAmountHigherThan=If amount higher than <strong>%s</strong> IfAmountHigherThan=If amount higher than <strong>%s</strong>
SourcesRepository=Repository for sources SourcesRepository=Repository for sources
Chart=Chart Chart=Chart
PassEncoding=Password encoding
##### Export ##### ##### Export #####
ExportsArea=Exports area ExportsArea=Exports area

View File

@ -55,3 +55,4 @@ IDOfPage=Id of page
WebsiteAccount=Web site account WebsiteAccount=Web site account
WebsiteAccounts=Web site accounts WebsiteAccounts=Web site accounts
AddWebsiteAccount=Create web site account AddWebsiteAccount=Create web site account
BackToListOfThirdParty=Back to list for Third Party

View File

@ -488,12 +488,10 @@ while ($i < min($num, $limit))
if ($key == 'status') $align.=($align?' ':'').'center'; if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td'.($align?' class="'.$align.'"':'').'>'; print '<td';
if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser'); if ($align) print ' class="'.$align.'"';
elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); print '>';
elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1); print $object->showOutputField($val, $key, $obj->$key, '');
elseif ($key == 'status') print $object->getLibStatut(3);
else print $obj->$key;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure'])) if (! empty($val['isameasure']))
@ -510,12 +508,12 @@ while ($i < min($num, $limit))
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
print '<td';
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print '<td';
if ($align) print ' align="'.$align.'"'; if ($align) print ' align="'.$align.'"';
print '>'; print '>';
$tmpkey='options_'.$key; $tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print $extrafields->showOutputField($key, $obj->$tmpkey, '');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure'])) if (! empty($val['isameasure']))

View File

@ -428,7 +428,7 @@ class Societe extends CommonObject
* @param User $user Object of user that ask creation * @param User $user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO * @return int >= 0 if OK, < 0 if KO
*/ */
function create($user) function create(User $user)
{ {
global $langs,$conf,$mysoc; global $langs,$conf,$mysoc;
@ -725,7 +725,7 @@ class Societe extends CommonObject
/** /**
* Update parameters of third party * Update parameters of third party
* *
* @param int $id id societe * @param int $id Id of company (deprecated, use 0 here and call update on an object loaded by a fetch)
* @param User $user Utilisateur qui demande la mise a jour * @param User $user Utilisateur qui demande la mise a jour
* @param int $call_trigger 0=non, 1=oui * @param int $call_trigger 0=non, 1=oui
* @param int $allowmodcodeclient Inclut modif code client et code compta * @param int $allowmodcodeclient Inclut modif code client et code compta
@ -739,6 +739,8 @@ class Societe extends CommonObject
global $langs,$conf,$hookmanager; global $langs,$conf,$hookmanager;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($id)) $id = $this->id;
$error=0; $error=0;
dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur); dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
@ -1461,11 +1463,11 @@ class Societe extends CommonObject
// Fill $toute_categs array with an array of (type => array of ("Categorie" instance)) // Fill $toute_categs array with an array of (type => array of ("Categorie" instance))
if ($this->client || $this->prospect) if ($this->client || $this->prospect)
{ {
$toute_categs['societe'] = $static_cat->containing($this->id,Categorie::TYPE_CUSTOMER); $toute_categs['customer'] = $static_cat->containing($this->id,Categorie::TYPE_CUSTOMER);
} }
if ($this->fournisseur) if ($this->fournisseur)
{ {
$toute_categs['fournisseur'] = $static_cat->containing($this->id,Categorie::TYPE_SUPPLIER); $toute_categs['supplier'] = $static_cat->containing($this->id,Categorie::TYPE_SUPPLIER);
} }
// Remove each "Categorie" // Remove each "Categorie"
@ -2085,7 +2087,7 @@ class Societe extends CommonObject
if ($this->email && $addthirdparty) if ($this->email && $addthirdparty)
{ {
if (empty($this->name)) $this->name=$this->nom; if (empty($this->name)) $this->name=$this->nom;
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." &lt;".$this->email."&gt;"; $contact_emails['thirdparty']=$langs->transnoentitiesnoconv("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">";
} }
//var_dump($contact_emails) //var_dump($contact_emails)
return $contact_emails; return $contact_emails;
@ -2106,7 +2108,7 @@ class Societe extends CommonObject
{ {
if (empty($this->name)) $this->name=$this->nom; if (empty($this->name)) $this->name=$this->nom;
// TODO: Tester si tel non deja present dans tableau contact // TODO: Tester si tel non deja present dans tableau contact
$contact_phone['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." &lt;".$this->phone."&gt;"; $contact_phone['thirdparty']=$langs->transnoentitiesnoconv("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->phone.">";
} }
return $contact_phone; return $contact_phone;
} }
@ -2116,7 +2118,7 @@ class Societe extends CommonObject
* *
* @param string $mode 'email' or 'mobile' * @param string $mode 'email' or 'mobile'
* @param int $hidedisabled 1=Hide contact if disabled * @param int $hidedisabled 1=Hide contact if disabled
* @return array Array of contacts emails or mobile array(id=>'Name <email>') * @return array Array of contacts emails or mobile. Example: array(id=>'Name <email>')
*/ */
function contact_property_array($mode='email', $hidedisabled=0) function contact_property_array($mode='email', $hidedisabled=0)
{ {
@ -2138,7 +2140,8 @@ class Societe extends CommonObject
$sepa="("; $sepb=")"; $sepa="("; $sepb=")";
if ($mode == 'email') if ($mode == 'email')
{ {
$sepa="&lt;"; $sepb="&gt;"; //$sepa="&lt;"; $sepb="&gt;";
$sepa="<"; $sepb=">";
} }
$i = 0; $i = 0;
while ($i < $nump) while ($i < $nump)
@ -2153,8 +2156,8 @@ class Societe extends CommonObject
{ {
if (empty($property)) if (empty($property))
{ {
if ($mode == 'email') $property=$langs->trans("NoEMail"); if ($mode == 'email') $property=$langs->transnoentitiesnoconv("NoEMail");
else if ($mode == 'mobile') $property=$langs->trans("NoMobilePhone"); else if ($mode == 'mobile') $property=$langs->transnoentitiesnoconv("NoMobilePhone");
} }
if (!empty($obj->poste)) if (!empty($obj->poste))

View File

@ -255,7 +255,7 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql); $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 (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').")"; if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")";
else $sql.=" WHERE 1 = 1"; else $sql.=" WHERE 1 = 1";
@ -488,12 +488,11 @@ while ($i < min($num, $limit))
if ($key == 'status') $align.=($align?' ':'').'center'; if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td'.($align?' class="'.$align.'"':'').'>'; print '<td';
if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser'); if ($align) print ' class="'.$align.'"';
elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); print '>';
elseif ($key == 'ref' || $key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
elseif ($key == 'status') print $objectwebsiteaccount->getLibStatut(3); else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
else print $obj->$key;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure'])) if (! empty($val['isameasure']))
@ -510,12 +509,12 @@ while ($i < min($num, $limit))
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
print '<td';
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print '<td';
if ($align) print ' align="'.$align.'"'; if ($align) print ' align="'.$align.'"';
print '>'; print '>';
$tmpkey='options_'.$key; $tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print $extrafields->showOutputField($key, $obj->$tmpkey, '');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure'])) if (! empty($val['isameasure']))

View File

@ -44,7 +44,11 @@ class Website extends CommonObject
*/ */
public $table_element = 'website'; 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'; public $picto = 'globe';

View File

@ -42,7 +42,7 @@ class WebsiteAccount 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 = 'websiteaccount'; public $table_element = 'website_account';
/** /**
* @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/ */
@ -77,14 +77,15 @@ class WebsiteAccount extends CommonObject
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), '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',), 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',),
'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1), 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>-2, 'enabled'=>1, 'position'=>30),
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>30, 'notnull'=>-1,), '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), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>41, 'notnull'=>1, 'index'=>1), 'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>41, 'notnull'=>1, 'index'=>1),
'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,), 'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,),
'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,), 'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,),
//'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-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,), 'note_private' => array('type'=>'text', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
@ -94,9 +95,11 @@ class WebsiteAccount extends CommonObject
); );
public $rowid; public $rowid;
public $login; public $login;
public $pass_encoding;
public $pass_crypted; public $pass_crypted;
public $date_last_login; public $date_last_login;
public $date_previous_login; public $date_previous_login;
public $note_private;
public $date_creation; public $date_creation;
public $tms; public $tms;
public $fk_user_creat; public $fk_user_creat;
@ -114,11 +117,11 @@ class WebsiteAccount extends CommonObject
/** /**
* @var int Name of subtable line * @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 * @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 * @var int Name of subtable class that manage subtable lines
*/ */
@ -126,7 +129,7 @@ class WebsiteAccount extends CommonObject
/** /**
* @var array Array of child tables (child tables to delete before deleting a record) * @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 * @var WebsiteAccountLine[] Array of subtable lines
*/ */
@ -316,12 +319,11 @@ class WebsiteAccount extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $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);
$result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto != 2) $result.= $this->ref;
if ($withpicto != 2) $result.=' '; $result .= $linkend;
}
$result.= $linkstart . $this->ref . $linkend;
return $result; return $result;
} }

View File

@ -44,7 +44,7 @@ class WebsitePage extends CommonObject
*/ */
public $table_element = 'website_page'; 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'; public $picto = 'label';

View File

@ -1152,7 +1152,7 @@ if (count($object->records) > 0)
print '</div>'; print '</div>';
print '<div class="websiteselection hideonsmartphoneimp">'; print '<div class="websiteselection hideonsmartphoneimp">';
print $langs->trans("Website").': '; print $langs->trans("WebSite").': ';
print '</div>'; print '</div>';
// List of website // List of website
@ -1306,10 +1306,10 @@ if (count($object->records) > 0)
if ($action == 'createfromclone') { if ($action == 'createfromclone') {
// Create an array for form // Create an array for form
$formquestion = array( $formquestion = array(
array('type' => 'text', 'name' => 'siteref', 'label'=> $langs->trans("Website") ,'value'=> 'copy_of_'.$object->ref), array('type' => 'text', 'name' => 'siteref', 'label'=> $langs->trans("WebSite") ,'value'=> 'copy_of_'.$object->ref),
//array('type' => 'checkbox', 'name' => 'is_a_translation', 'label' => $langs->trans("SiteIsANewTranslation"), 'value' => 0), //array('type' => 'checkbox', 'name' => 'is_a_translation', 'label' => $langs->trans("SiteIsANewTranslation"), 'value' => 0),
//array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, '', 0, 0, 'minwidth200')), //array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, '', 0, 0, 'minwidth200')),
//array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("Website"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)) //array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0))
); );
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id='.$object->id, $langs->trans('CloneSite'), '', 'confirm_createfromclone', $formquestion, 0, 1, 200); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id='.$object->id, $langs->trans('CloneSite'), '', 'confirm_createfromclone', $formquestion, 0, 1, 200);
@ -1326,7 +1326,7 @@ if (count($object->records) > 0)
array('type' => 'text', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME") ,'value'=> 'copy_of_'.$objectpage->pageurl), array('type' => 'text', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME") ,'value'=> 'copy_of_'.$objectpage->pageurl),
array('type' => 'checkbox', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0), array('type' => 'checkbox', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0),
array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, 1, 0, 0, 'minwidth200')), array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, 1, 0, 0, 'minwidth200')),
array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("Website"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)), array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)),
); );
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?website='.$object->ref.'&pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?website='.$object->ref.'&pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550);

View File

@ -41,7 +41,7 @@ function websiteaccountPrepareHead($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $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; $nbNote = 0;
if(!empty($object->fields['note_private'])) $nbNote++; 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>'; if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
} }*/
/* /*
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -219,6 +219,8 @@ if (($id || $ref) && $action == 'edit')
// Part to show record // Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{ {
if ($object->fk_soc >0 && empty($socid)) $socid = $object->fk_soc;
$res = $object->fetch_optionals($object->id, $extralabels); $res = $object->fetch_optionals($object->id, $extralabels);
$head = websiteaccountPrepareHead($object); $head = websiteaccountPrepareHead($object);
@ -259,7 +261,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card // Object card
// ------------------------------------------------------------ // ------------------------------------------------------------
$linkback=''; $linkback='';
if ($socid) $linkback = '<a href="' .DOL_URL_ROOT.'/societe/website.php?socid='.$socid.'&restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; if ($socid) $linkback = '<a href="' .DOL_URL_ROOT.'/societe/website.php?socid='.$socid.'&restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToListOfThirdParty") . '</a>';
if ($fk_website) $linkback = '<a href="' .DOL_URL_ROOT.'/website/website_card.php?fk_website='.$fk_website.'&restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; if ($fk_website) $linkback = '<a href="' .DOL_URL_ROOT.'/website/website_card.php?fk_website='.$fk_website.'&restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
@ -306,8 +308,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/ */
$morehtmlref.='</div>'; $morehtmlref.='</div>';
if ($socid > 0) $object->next_prev_filter = 'te.fk_soc = '.$socid;
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';