'."\n";
+ print ''."\n";
// Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index a6ccd9f7cf1..038de071863 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -189,6 +189,12 @@ class Contrat extends CommonObject
protected $lines_id_index_mapper=array();
+ const STATUS_DRAFT = 0;
+ const STATUS_VALIDATED = 1;
+ const STATUS_CLOSED = 2;
+
+
+
/**
* Constructor
*
@@ -1881,40 +1887,31 @@ class Contrat extends CommonObject
/**
* Renvoi label of a given contrat status
*
- * @param int $statut Status id
+ * @param int $status Id status
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
* @return string Label
*/
- public function LibStatut($statut, $mode)
+ public function LibStatut($status, $mode)
{
// phpcs:enable
- global $langs;
- $langs->load("contracts");
- if ($mode == 0)
+
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
- if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
- elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
- elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
+ global $langs;
+ $langs->load("contracts");
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
+ $this->labelStatus[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
+ $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
+ $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
+ $this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
}
- elseif ($mode == 1)
- {
- if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
- elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
- elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
- }
- elseif ($mode == 2)
- {
- if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0').' '.$langs->trans("ContractStatusDraft"); }
- elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4').' '.$langs->trans("ContractStatusValidated"); }
- elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6').' '.$langs->trans("ContractStatusClosed"); }
- }
- elseif ($mode == 3)
- {
- if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
- elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
- elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
- }
- elseif ($mode == 4 || $mode == 6 || $mode == 7)
+
+ $statusType = 'status'.$status;
+ if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
+ if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
+
+ if ($mode == 4 || $mode == 6 || $mode == 7)
{
$text='';
if ($mode == 4) {
@@ -1924,22 +1921,20 @@ class Contrat extends CommonObject
$text.=': ';
$text.='';
}
- $text.=($mode == 7?'':'');
- $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
- $text.=($mode == 7?'
':'');
- $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')) : '';
- $text.=($mode == 7?'
':'');
+ $text.=($mode == 7?'':'');
+ $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
+ $text.=($mode == 7?'':'');
+ $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
+ $text.=($mode == 7?'':'');
+ $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
+ $text.=($mode == 7?'':'');
+ $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : '';
+ $text.=($mode == 7?'':'');
return $text;
}
- elseif ($mode == 5)
+ else
{
- if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
- elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
- elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
}
@@ -2728,65 +2723,34 @@ class ContratLigne extends CommonObjectLine
/**
* Return label of a contract line status
*
- * @param int $statut Id statut
+ * @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $expired 0=Not expired, 1=Expired, -1=Both or unknown
* @param string $moreatt More attribute
* @return string Libelle
*/
- public static function LibStatut($statut, $mode, $expired = -1, $moreatt = '')
+ public static function LibStatut($status, $mode, $expired = -1, $moreatt = '')
{
// phpcs:enable
global $langs;
$langs->load("contracts");
- if ($mode == 0)
+
+ if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); }
+ elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); }
+ elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); }
+ elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); }
+ elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); }
+
+ $statusType = 'status'.$status;
+ if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3';
+ if ($status == self::STATUS_CLOSED) $statusType = 'status6';
+
+ $params = array(); $reg = array();
+ if (preg_match('/class="(.*)"/', $moreatt, $reg))
{
- if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
- elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 1)
- {
- if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
- elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 2)
- {
- if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
- elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 3)
- {
- if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0', $moreatt); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4', $moreatt); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4', $moreatt); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3', $moreatt); }
- elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6', $moreatt); }
- }
- elseif ($mode == 4)
- {
- if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLate"); }
- elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
- }
- elseif ($mode == 5)
- {
- if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'), 'statut0'); }
- elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'), 'statut4'); }
- elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'), 'statut4'); }
- elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'), 'statut3'); }
- elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'), 'statut6'); }
+ $params = array('badgeParams'=>array('css' => $reg[1]));
}
+ return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
}
/**
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 56b0dc93c35..7750e62c506 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -8093,19 +8093,18 @@ function roundUpToNextMultiple($n, $x = 5)
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
{
$attr=array(
- 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
+ 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'').(empty($params['css'])?'':' '.$params['css'])
);
- if(empty($html)){
+ if (empty($html)) {
$html = $label;
}
- if(!empty($url)){
+ if (!empty($url)) {
$attr['href'] = $url;
}
- if($mode==='dot')
- {
+ if ($mode==='dot') {
$attr['class'].= ' classfortooltip';
$attr['title'] = $html;
$attr['aria-label'] = $label;
@@ -8113,8 +8112,8 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
}
// Override attr
- if(!empty($params['attr']) && is_array($params['attr'])){
- foreach($params['attr']as $key => $value){
+ if (!empty($params['attr']) && is_array($params['attr'])) {
+ foreach($params['attr']as $key => $value) {
$attr[$key] = $value;
}
}
@@ -8125,7 +8124,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
$attr = array_map('dol_escape_htmltag', $attr);
$TCompiledAttr = array();
- foreach($attr as $key => $value){
+ foreach($attr as $key => $value) {
$TCompiledAttr[] = $key.'="'.$value.'"';
}
@@ -8168,13 +8167,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
elseif ($displayMode == 1) {
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
}
- // use status with images
- elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) {
+ // Use status with images (for backward compatibility)
+ elseif (! empty($conf->global->MAIN_STATUS_USES_IMAGES)) {
$return = '';
$htmlLabel = (in_array($displayMode, array(1,2,5))?'':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'':'');
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'':'');
- // For small screen, we use the short label instead of long label.
+ // For small screen, we always use the short label instead of long label.
if (! empty($conf->dol_optimize_smallscreen))
{
if ($displayMode == 0) $displayMode = 1;
@@ -8212,7 +8211,6 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
$return = $htmlImg .' '. $htmlLabel;
}
elseif ($displayMode === 5) {
- // Add here a span class="hideonsmartphone ?
$return = $htmlLabelShort .' '. $htmlImg;
}
else { // $displayMode >= 6
@@ -8220,7 +8218,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
}
}
// Use new badge
- elseif (!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)) {
+ elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
if ($displayMode == 3) {
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 0c80b05c9cd..ecadec1b5a8 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -2023,23 +2023,23 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
- $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.'%';
- $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.'%';
+ $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : '');
+ $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : '');
- if($progressCalculated > doubleval($task->progress)){
+ if($progressCalculated > doubleval($task->progress)) {
$progressBarClass = 'progress-bar-danger';
- $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
- $diff = ' '.($task->progress-$progressCalculated).'%';
+ $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
+ $diff = ' '.($task->progress-$progressCalculated).'%';
}
- elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
+ elseif($progressCalculated * $warningRatio >= doubleval($task->progress)) { // warning if close at 1%
$progressBarClass = 'progress-bar-warning';
- $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
- $diff = ' '.($task->progress-$progressCalculated).'%';
+ $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
+ $diff = ' '.($task->progress-$progressCalculated).'%';
}
else{
$progressBarClass = 'progress-bar-success';
- $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).'%');
- $diff = ' '.($task->progress-$progressCalculated).'%';
+ $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).' '.$langs->trans("point"));
+ $diff = ' '.($task->progress-$progressCalculated).'%';
}
}
@@ -2062,7 +2062,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
if($progressNumber !== false)
{
$out.= ' ';
- if($progressNumber!==true){
+ if ($progressNumber!==true) {
$out.= $progressNumber; // replace label by param
}
else{
@@ -2087,8 +2087,21 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$out.= '';
- $out.= ' ';
- $out.= '
';
+ $out.= '
';
+ $diffval = doubleval($task->progress) - doubleval($progressCalculated);
+ if ($diffval >= 0) {
+ // good
+ $out.= '
';
+ $out.= '
';
+ $out.= '
';
+ }
+ else
+ {
+ // bad
+ $out.= '
';
+ $out.= '
';
+ $out.= '
';
+ }
$out.= '
';
$out.= '
';
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 6717b42609b..0b67fcb621f 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -183,6 +183,10 @@ class EmailCollector extends CommonObject
public $debuginfo;
+ const STATUS_DISABLED = 0;
+ const STATUS_ENABLED = 1;
+
+
/**
* Constructor
*
@@ -506,47 +510,20 @@ class EmailCollector extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- if (empty($this->labelStatus))
+ if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
//$langs->load("mymodule");
- $this->labelStatus[1] = $langs->trans('Enabled');
- $this->labelStatus[0] = $langs->trans('Disabled');
+ $this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
+ $this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled');
+ $this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled');
+ $this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled');
}
- if ($mode == 0)
- {
- return $this->labelStatus[$status];
- }
- elseif ($mode == 1)
- {
- return $this->labelStatus[$status];
- }
- elseif ($mode == 2)
- {
- if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
- elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
- }
- elseif ($mode == 3)
- {
- if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 4)
- {
- if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
- elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
- }
- elseif ($mode == 5)
- {
- if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 6)
- {
- if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
+ $statusType = 'status5';
+ if ($status == self::STATUS_ENABLED) $statusType = 'status4';
+
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 1f8399d939a..59d16eba2fc 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -6,7 +6,7 @@ ModuleBuilderDesc2=Path where modules are generated/edited (first directory for
ModuleBuilderDesc3=Generated/editable modules found: %s
ModuleBuilderDesc4=A module is detected as 'editable' when the file %s exists in root of module directory
NewModule=New module
-NewObject=New object
+NewObjectInModulebuilder=New object
ModuleKey=Module key
ObjectKey=Object key
ModuleInitialized=Module initialized
@@ -66,8 +66,8 @@ ReadmeFile=Readme file
ChangeLog=ChangeLog file
TestClassFile=File for PHP Unit Test class
SqlFile=Sql file
-PageForLib=File for PHP library
-PageForObjLib=File for PHP library dedicated to object
+PageForLib=File for the common PHP library
+PageForObjLib=File for the PHP library dedicated to object
SqlFileExtraFields=Sql file for complementary attributes
SqlFileKey=Sql file for keys
SqlFileKeyExtraFields=Sql file for keys of complementary attributes
@@ -124,4 +124,8 @@ UseSpecificEditorURL = Use a specific editor URL
UseSpecificFamily = Use a specific family
UseSpecificAuthor = Use a specific author
UseSpecificVersion = Use a specific initial version
-ModuleMustBeEnabled=The module/application must be enabled first
\ No newline at end of file
+ModuleMustBeEnabled=The module/application must be enabled first
+IncludeRefGeneration=The reference of object must be generated automatically
+IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference
+IncludeDocGeneration=I want to generate some documents from the object
+IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 234746a0d83..a6df5f9db43 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2004-2019 Laurent Destailleur
* Copyright (C) 2018-2019 Nicolas ZABOURI
*
* This program is free software; you can redistribute it and/or modify
@@ -810,6 +810,21 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
);
+ if (GETPOST('includerefgeneration', 'int'))
+ {
+ $filetogenerate += array(
+ 'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
+ 'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php',
+ 'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
+ );
+ }
+ if (GETPOST('includedocgeneration', 'int'))
+ {
+ $filetogenerate += array(
+ 'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
+ );
+ }
+
foreach($filetogenerate as $srcfile => $destfile)
{
$result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0);
@@ -1123,7 +1138,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
}
}
-if ($dirins && $action == 'confirm_delete')
+if ($dirins && $action == 'confirm_deletemodule')
{
if (preg_match('/[^a-z0-9_]/i', $module))
{
@@ -1150,8 +1165,6 @@ if ($dirins && $action == 'confirm_delete')
}
}
- //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
- //exit;
$action = '';
$module = 'deletemodule';
}
@@ -1173,26 +1186,30 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
$dir = $dirins.'/'.$modulelowercase;
// Delete some files
- $filetogenerate = array(
- 'myobject_card.php'=>strtolower($objectname).'_card.php',
- 'myobject_note.php'=>strtolower($objectname).'_note.php',
- 'myobject_document.php'=>strtolower($objectname).'_document.php',
- 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
- 'myobject_list.php'=>strtolower($objectname).'_list.php',
- 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php',
- 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
- 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
- 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
- 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
- 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
- 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
- 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
- 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
- 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php'
+ $filetodelete = array(
+ 'myobject_card.php'=>strtolower($objectname).'_card.php',
+ 'myobject_note.php'=>strtolower($objectname).'_note.php',
+ 'myobject_document.php'=>strtolower($objectname).'_document.php',
+ 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
+ 'myobject_list.php'=>strtolower($objectname).'_list.php',
+ 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php',
+ 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
+ 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
+ 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
+ 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
+ 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
+ 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
+ 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
+ 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
+ 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php',
+ 'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
+ 'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php',
+ 'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
+ 'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
);
$resultko = 0;
- foreach($filetogenerate as $filetodelete)
+ foreach($filetodelete as $filetodelete)
{
$resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1);
if (! $resulttmp) $resultko++;
@@ -1208,8 +1225,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
}
}
- //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
- //exit;
$action = '';
$tabobj = 'deleteobject';
}
@@ -1436,6 +1451,7 @@ if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >=2 ||
// Search modules to edit
print ''."\n";
$listofmodules=array();
+$i=0;
foreach($dirsrootforscan as $dirread)
{
$dirsincustom=dol_dir_list($dirread, 'directories');
@@ -1493,8 +1509,12 @@ foreach($dirsrootforscan as $dirread)
if (empty($newdircustom)) $newdircustom=img_warning();
// If dirread was forced to somewhere else, by using URL
// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
- print $langs->trans("DirScanned").' : '.$dirread.'
';
+ if (empty($i)) print $langs->trans("DirScanned").' : ';
+ else print ', ';
+ print ''.$dirread.'';
+ $i++;
}
+print '
';
//var_dump($listofmodules);
$message='';
@@ -1526,7 +1546,7 @@ if ($message)
}
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'
';
-$infomodulesfound = ''.$form->textwithpicto($langs->trans("ModuleBuilderDesc3", count($listofmodules)), $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
';
+$infomodulesfound = ''.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).'', $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
';
// Load module descriptor
@@ -1601,16 +1621,17 @@ if ($module == 'initmodule')
print $langs->trans("EnterNameOfModuleDesc").'
';
print '
';
- print '';
+ print '
';
- print '';
+ print '
';
print '';
}
elseif ($module == 'deletemodule')
{
+ print ''."\n";
print '
';
@@ -1983,7 +2006,7 @@ elseif (! empty($module))
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.'';
- print ' '.img_picto($langs->trans("Edit"), 'edit').'';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
print ' '.$langs->trans("LanguageFile").' : ';
if (! is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").'';
@@ -2113,7 +2136,7 @@ elseif (! empty($module))
$dir = $dirread.'/'.$modulelowercase.'/class';
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject';
- $head3[$h][1] = $langs->trans("NewObject");
+ $head3[$h][1] = ''.$langs->trans("NewObjectInModulebuilder").'';
$head3[$h][2] = 'newobject';
$h++;
@@ -2165,7 +2188,9 @@ elseif (! empty($module))
print ''.$langs->trans("EnterNameOfObjectDesc").'
';
- print '';
+ print '
';
+ print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'
';
+ print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'
';
print '';
print '
';
print '
';
@@ -2173,7 +2198,6 @@ elseif (! empty($module))
print $langs->trans("or");
print '
';
print '
';
- print '
';
//print ' ';
print $langs->trans("InitStructureFromExistingTable");
print '';
@@ -2687,7 +2711,7 @@ elseif (! empty($module))
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.'';
- print ' '.img_picto($langs->trans("Edit"), 'edit').'';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
print '
';
@@ -2827,7 +2851,7 @@ elseif (! empty($module))
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.'';
- print ' '.img_picto($langs->trans("Edit"), 'edit').'';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
print '
';
@@ -2924,7 +2948,7 @@ elseif (! empty($module))
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.'';
print '';
- print ''.img_picto($langs->trans("Edit"), 'edit').'';
+ print ''.img_picto($langs->trans("Edit"), 'edit').'';
print ' | ';
print '| ';
@@ -2933,8 +2957,8 @@ elseif (! empty($module))
if (dol_is_file($dirins.'/'.$pathtohook))
{
print ''.$pathtohook.'';
- print ' | '.img_picto($langs->trans("Edit"), 'edit').' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
}
else
{
@@ -2991,8 +3015,8 @@ elseif (! empty($module))
print '
| ';
print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.'';
- print ' | '.img_picto($langs->trans("Edit"), 'edit').' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
print '
';
}
}
@@ -3047,8 +3071,8 @@ elseif (! empty($module))
if (dol_is_file($dirins.'/'.$pathtohook))
{
print ''.$pathtohook.'';
- print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
}
else
{
@@ -3099,8 +3123,8 @@ elseif (! empty($module))
if (dol_is_file($dirins.'/'.$pathtohook))
{
print ''.$pathtohook.'';
- print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
}
else
{
@@ -3155,9 +3179,8 @@ elseif (! empty($module))
$pathtofile = $widget['relpath'];
print '| '.$langs->trans("WidgetFile").' : '.$pathtofile.'';
- print ' '.img_picto($langs->trans("Edit"), 'edit').'';
- print ' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').'';
+ print ' | '.img_picto($langs->trans("Delete"), 'delete').' | ';
print '
';
}
}
@@ -3242,8 +3265,8 @@ elseif (! empty($module))
$pathtofile = $clifile['relpath'];
print '| '.$langs->trans("CLIFile").' : '.$pathtofile.'';
- print ' | '.img_picto($langs->trans("Edit"), 'edit').' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
print '
';
}
}
@@ -3294,7 +3317,7 @@ elseif (! empty($module))
print '
';
print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.'';
- print ' '.img_picto($langs->trans("Edit"), 'edit').'';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
print '
';
@@ -3423,8 +3446,8 @@ elseif (! empty($module))
if (preg_match('/\.md$/i', $spec['name'])) $format='markdown';
print '| ';
print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.'';
- print ' | '.img_picto($langs->trans("Edit"), 'edit').' | ';
- print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
+ print ''.img_picto($langs->trans("Edit"), 'edit').' | ';
+ print ''.img_picto($langs->trans("Delete"), 'delete').' | ';
print '
';
}
}
diff --git a/htdocs/mrp/ChangeLog.md b/htdocs/mrp/ChangeLog.md
deleted file mode 100644
index 416bad1d559..00000000000
--- a/htdocs/mrp/ChangeLog.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# CHANGELOG MRP FOR DOLIBARR ERP CRM
-
-## 1.0
-Initial version
-
diff --git a/htdocs/takepos/ChangeLog.md b/htdocs/takepos/ChangeLog.md
deleted file mode 100644
index 7b623eaa252..00000000000
--- a/htdocs/takepos/ChangeLog.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# CHANGELOG TAKEPOS FOR DOLIBARR ERP CRM
-
-## 1.0
-Initial version
-
diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php
index 975f2eb311f..27fc142d991 100644
--- a/htdocs/theme/eldy/badges.inc.php
+++ b/htdocs/theme/eldy/badges.inc.php
@@ -37,7 +37,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
padding: 0;
border-radius: 50%;
padding: 0.45em;
- vertical-align: middle;
+ vertical-align: text-top;
}
a.badge:focus, a.badge:hover {
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index cf5c4f9703a..4a3b73b1d20 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -473,6 +473,12 @@ textarea.centpercent {
.paddingright2 {
padding-: 2px;
}
+.marginleft2 {
+ margin-: 2px;
+}
+.marginright2 {
+ margin-: 2px;
+}
.cursordefault {
cursor: default;
}
diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php
index 3e330745440..c6b48205360 100644
--- a/htdocs/theme/eldy/progress.inc.php
+++ b/htdocs/theme/eldy/progress.inc.php
@@ -21,10 +21,10 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
height: 20px;
overflow: hidden;
background-color: #f5f5f5;
- background-color: rgba(0,0,0,0.1);
+ background-color: rgba(128, 128, 128, 0.1);
border-radius: 4px;
- -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
- box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.progress.spaced{
@@ -184,4 +184,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
+}
+.progress-bar-consumed {
+ background-color: rgb(0, 0, 0, 0.15);
}
\ No newline at end of file
diff --git a/htdocs/theme/md/badges.inc.php b/htdocs/theme/md/badges.inc.php
index 2a1b9ffd24b..11536240ee0 100644
--- a/htdocs/theme/md/badges.inc.php
+++ b/htdocs/theme/md/badges.inc.php
@@ -36,8 +36,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
.badge-dot {
padding: 0;
border-radius: 50%;
- padding: 0.25rem;
- vertical-align: middle;
+ padding: 0.35em;
+ vertical-align: unset;
}
a.badge:focus, a.badge:hover {
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 320a03c2775..04fe7e85d77 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -676,6 +676,12 @@ textarea.centpercent {
.paddingright2 {
padding-: 2px;
}
+.marginleft2 {
+ margin-: 2px;
+}
+.marginright2 {
+ margin-: 2px;
+}
.cursordefault {
cursor: default;
}