Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/adherents/stats/byproperties.php
	htdocs/adherents/stats/geo.php
	htdocs/admin/system/dolibarr.php
	htdocs/core/class/commonobjectline.class.php
	htdocs/core/tpl/objectline_title.tpl.php
	htdocs/langs/en_US/admin.lang
	htdocs/product/class/product.class.php
This commit is contained in:
Laurent Destailleur 2020-09-14 02:49:19 +02:00
commit 59bc8ee07c
9 changed files with 67 additions and 55 deletions

View File

@ -68,7 +68,7 @@ class AdherentStats extends Stats
$this->field = 'subscription';
$this->where .= " m.statut != 0";
$this->where .= " m.statut != -1";
$this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($this->memberid) {

View File

@ -102,17 +102,17 @@ dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'use
// Print title
if (!count($data)) {
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<span class="opacitymedium">'.$langs->trans("NoValidatedMemberYet").'</span><br>';
print '<br>';
} else {
print $langs->trans("MembersByNature").'<br>';
print '<span class="opacitymedium">'.$langs->trans("MembersByNature").'</span><br>';
print '<br>';
}
// Print array
print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Nature").'</td>';
print '<td>'.$langs->trans("MemberNature").'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
print '<td class="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';

View File

@ -204,12 +204,13 @@ if ($mode && !count($data)) {
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
} else {
if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'<br>';
elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'<br>';
elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'<br>';
elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'<br>'; //+
else {
print $langs->trans("MembersStatisticsDesc").'<br>';
if ($mode == 'memberbycountry') print '<span class="opacitymedium">'.$langs->trans("MembersByCountryDesc").'</span><br>';
elseif ($mode == 'memberbystate') print '<span class="opacitymedium">'.$langs->trans("MembersByStateDesc").'</span><br>';
elseif ($mode == 'memberbytown') print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>';
elseif ($mode == 'memberbyregion') print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+
else
{
print '<span class="opacitymedium">'.$langs->trans("MembersStatisticsDesc").'</span><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>';
print '<br>';

View File

@ -176,9 +176,9 @@ foreach ($data as $val) {
$oldyear--;
print '<tr class="oddeven" height="24">';
print '<td class="center">';
print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
//print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
print $oldyear;
print '</a>';
//print '</a>';
print '</td>';
print '<td class="right">0</td>';
print '<td class="right">0</td>';

View File

@ -367,8 +367,7 @@ foreach ($configfileparameters as $key => $value)
print "<td>";
if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i', '*', ${$newkey});
elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
elseif ($newkey == 'dolibarr_main_document_root_alt')
{
elseif ($newkey == 'dolibarr_main_document_root_alt') {
$tmparray = explode(',', ${$newkey});
$i = 0;
foreach ($tmparray as $value2)
@ -382,8 +381,7 @@ foreach ($configfileparameters as $key => $value)
}
++$i;
}
} elseif ($newkey == 'dolibarr_main_instance_unique_id')
{
} elseif ($newkey == 'dolibarr_main_instance_unique_id') {
//print $conf->file->instance_unique_id;
global $dolibarr_main_cookie_cryptkey;
$valuetoshow = ${$newkey} ? ${$newkey} : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
@ -392,6 +390,13 @@ foreach ($configfileparameters as $key => $value)
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
}
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("HashForPing").'='.md5('dolibarr'.$valuetoshow).')</span>';
} elseif ($newkey == 'dolibarr_main_prod') {
print ${$newkey};
$valuetoshow = ${$newkey};
if (empty($valuetoshow)) {
print img_warning($langs->trans('SwitchThisForABetterSecurity'));
}
} else {
print ${$newkey};
}

View File

@ -61,11 +61,11 @@ abstract class CommonObjectLine extends CommonObject
}
/**
* Returns the translation key from units dictionary.
* Returns the label, shot_label or code found in units dictionary from ->fk_unit.
* A langs->trans() must be called on result to get translated value.
*
* @param string $type Label type (long or short). This can be a translation key.
* @return string|int <0 if ko, label if ok
* @param string $type Label type ('long', 'short' or 'code'). This can be a translation key.
* @return string|int <0 if KO, label if OK (Example: 'long', 'short' or 'unitCODE')
*/
public function getLabelOfUnit($type = 'long')
{
@ -79,17 +79,16 @@ abstract class CommonObjectLine extends CommonObject
$label_type = 'label';
if ($type == 'short')
{
$label_type = 'short_label';
}
$label_type = 'label';
if ($type == 'short') $label_type = 'short_label';
elseif ($type == 'code') $label_type = 'code';
$sql = 'select '.$label_type.',code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0)
{
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']);
if ($label_type == 'code') $label = 'unit'.$res['code'];
else $label = $res[$label_type];
$this->db->free($resql);
return $label;
} else {

View File

@ -59,7 +59,12 @@ if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier'
}
// VAT
print '<td class="linecolvat right" style="width: 80px">'.$langs->trans('VAT');
print '<td class="linecolvat right" style="width: 80px">'
if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FACTURE_LOCAL_TAX2_OPTION)) {
print $langs->trans('Taxes');
} else {
print $langs->trans('VAT');
}
if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT)
{
global $mysoc;

View File

@ -2056,3 +2056,4 @@ TemplateAdded=Template added
TemplateUpdated=Template updated
TemplateDeleted=Template deleted
MailToSendEventPush=Template for event reminder emails
SwitchThisForABetterSecurity=Switching this value to 1 is recommended for more security

View File

@ -5204,15 +5204,17 @@ class Product extends CommonObject
$this->barcode = -1; // Create barcode automatically
}
/**
* Returns the text label from units dictionary
*
* @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok
*/
public function getLabelOfUnit($type = 'long')
{
global $langs;
/**
* Returns the label, shot_label or code found in units dictionary from ->fk_unit.
* A langs->trans() must be called on result to get translated value.
*
* @param string $type Label type (long, short or code)
* @return string|int <0 if KO, label if OK (Example: 'long', 'short', 'unitCODE')
* @see getLabelOfUnit() in CommonObjectLine
*/
public function getLabelOfUnit($type = 'long')
{
global $langs;
if (!$this->fk_unit) {
return '';
@ -5220,25 +5222,24 @@ class Product extends CommonObject
$langs->load('products');
$label_type = 'label';
$label_type = 'label';
if ($type == 'short') $label_type = 'short_label';
elseif ($type == 'code') $label_type = 'code';
if ($type == 'short') {
$label_type = 'short_label';
}
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$label = ($label_type == 'short_label' ? $res[$label_type] : 'unit'.$res['code']);
$this->db->free($resql);
return $label;
} else {
$this->error = $this->db->error().' sql='.$sql;
dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR);
return -1;
}
}
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
if ($label_type == 'code') $label = 'unit'.$res['code'];
else $label = $res[$label_type];
$this->db->free($resql);
return $label;
} else {
$this->error = $this->db->error().' sql='.$sql;
dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Return if object has a sell-by date or eat-by date