Clean code and translation
This commit is contained in:
parent
6276bb77ad
commit
fb6e5f03f9
@ -123,6 +123,12 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* @var string Agenda event label
|
||||
* @deprecated Use $label
|
||||
*/
|
||||
public $libelle;
|
||||
|
||||
/**
|
||||
* @var integer Date creation record (datec)
|
||||
*/
|
||||
@ -1439,9 +1445,9 @@ class ActionComm extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Return label of status
|
||||
* Return the label of the 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 $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
|
||||
* @return string String with status
|
||||
*/
|
||||
@ -1628,36 +1634,34 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
if ($withpicto == 2) {
|
||||
$libelle = $label;
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
$libelle = $labeltype;
|
||||
$label = $labeltype;
|
||||
}
|
||||
$libelleshort = '';
|
||||
$labelshort = '';
|
||||
} else {
|
||||
$libelle = (empty($this->libelle) ? $label : $this->libelle.(($label && $label != $this->libelle) ? ' '.$label : ''));
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) {
|
||||
$libelle = $labeltype;
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($label)) {
|
||||
$label = $labeltype;
|
||||
}
|
||||
if ($maxlength < 0) {
|
||||
$libelleshort = $this->ref;
|
||||
$labelshort = $this->ref;
|
||||
} else {
|
||||
$libelleshort = dol_trunc($libelle, $maxlength);
|
||||
$labelshort = dol_trunc($label, $maxlength);
|
||||
}
|
||||
}
|
||||
|
||||
if ($withpicto) {
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { // Add code into ()
|
||||
if ($labeltype) {
|
||||
$libelle .= (preg_match('/'.preg_quote($labeltype, '/').'/', $libelle) ? '' : ' ('.$langs->transnoentities("Action".$this->type_code).')');
|
||||
$label .= (preg_match('/'.preg_quote($labeltype, '/').'/', $label) ? '' : ' ('.$langs->transnoentities("Action".$this->type_code).')');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
$result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
$result .= $libelleshort;
|
||||
$result .= $labelshort;
|
||||
$result .= $linkend;
|
||||
|
||||
global $action;
|
||||
|
||||
@ -205,9 +205,9 @@ class ActionCommReminder extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du status d'un user (actif, inactif)
|
||||
* Return label of the status of a reminder
|
||||
*
|
||||
* @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 $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
|
||||
@ -837,7 +837,7 @@ if ($resql) {
|
||||
|
||||
$event->fk_project = $obj->fk_project;
|
||||
|
||||
$event->thirdparty_id = $obj->fk_soc;
|
||||
$event->socid = $obj->fk_soc;
|
||||
$event->contact_id = $obj->fk_contact;
|
||||
|
||||
// Defined date_start_in_calendar and date_end_in_calendar property
|
||||
@ -1964,7 +1964,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if ($event->type_code != 'ICALEVENT') {
|
||||
$savlabel = $event->label ? $event->label : $event->libelle;
|
||||
$event->label = $titletoshow;
|
||||
$event->libelle = $titletoshow;
|
||||
$event->libelle = $titletoshow; // deprecatd
|
||||
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
|
||||
$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
|
||||
$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0);
|
||||
@ -1996,7 +1996,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
|
||||
}
|
||||
|
||||
$thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
|
||||
$thirdparty_id = ($event->socid > 0 ? $event->socid : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
|
||||
$contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
|
||||
|
||||
// If action related to company / contact
|
||||
|
||||
@ -157,10 +157,10 @@ if ($resql) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"), "contact");
|
||||
print '</a> <a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.$obj->name.'</a></td>';
|
||||
print "<td>$obj->firstname</TD>";
|
||||
print '<td>'.dol_escape_htmltag($obj->firstname).'</td>';
|
||||
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"), "company").'</a> ';
|
||||
print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->name</a></td>\n";
|
||||
print '<a href="'.$urlfiche."?socid=".$obj->rowid.'">'.$obj->name."</a></td>\n";
|
||||
|
||||
print '<td>'.dol_print_phone($obj->email, $obj->cidp, $obj->rowid, 'AC_EMAIL').'</td>';
|
||||
|
||||
|
||||
@ -230,7 +230,7 @@ class FormAdvTargetEmailing extends Form
|
||||
$InfoFieldList = explode(":", $param_list [0]);
|
||||
|
||||
// 0 1 : tableName
|
||||
// 1 2 : label field name Nom du champ contenant le libelle
|
||||
// 1 2 : label field name Name of field that contains the label
|
||||
// 2 3 : key fields name (if differ of rowid)
|
||||
// 3 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
|
||||
|
||||
@ -304,7 +304,7 @@ class FormAdvTargetEmailing extends Form
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
// If a translation exists, we use it, else we use the default label
|
||||
$label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : ''));
|
||||
|
||||
$options_array[$obj->code] = $label;
|
||||
|
||||
@ -754,7 +754,7 @@ class Mailing extends CommonObject
|
||||
/**
|
||||
* Return label of status of emailing (draft, validated, ...)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
@ -764,10 +764,10 @@ class Mailing extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
* Return the label of a given status
|
||||
*
|
||||
* @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 $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0)
|
||||
@ -792,11 +792,11 @@ class Mailing extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
* Return the label of a given status of a recipient
|
||||
* TODO Add class mailin_target.class.php
|
||||
*
|
||||
* @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 $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param string $desc Desc error
|
||||
* @return string Label
|
||||
*/
|
||||
|
||||
@ -77,7 +77,7 @@ if (!empty($conf->propal->enabled)) {
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(*) as cc, st.libelle, st.picto, st.id";
|
||||
$sql = "SELECT count(*) as cc, st.libelle as stcomm, st.picto, st.id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user