Correction pour validation Stickler CI / stickler-ci

This commit is contained in:
kamel 2020-04-27 18:01:07 +02:00
parent 4dd42496fa
commit 28d330996c
5 changed files with 44 additions and 42 deletions

View File

@ -1777,7 +1777,7 @@ class Contact extends CommonObject
* @param int $active 1=Active only, 0=Not active only, -1=All * @param int $active 1=Active only, 0=Not active only, -1=All
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function loadCacheOfProspStatus($active=1) public function loadCacheOfProspStatus($active = 1)
{ {
global $langs; global $langs;
@ -1800,7 +1800,7 @@ class Contact extends CommonObject
* *
* @return string Libelle * @return string Libelle
*/ */
function getLibProspLevel() public function getLibProspLevel()
{ {
return $this->LibProspLevel($this->fk_prospectlevel); return $this->LibProspLevel($this->fk_prospectlevel);
} }
@ -1811,7 +1811,7 @@ class Contact extends CommonObject
* @param int $fk_prospectlevel Prospect level * @param int $fk_prospectlevel Prospect level
* @return string label of level * @return string label of level
*/ */
function LibProspLevel($fk_prospectlevel) public function LibProspLevel($fk_prospectlevel)
{ {
global $langs; global $langs;
@ -1832,7 +1832,7 @@ class Contact extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @deprecated Use update function instead * @deprecated Use update function instead
*/ */
function set_prospect_level(User $user) public function setProspectLevel(User $user)
{ {
return $this->update($this->id, $user); return $this->update($this->id, $user);
} }
@ -1844,9 +1844,9 @@ class Contact extends CommonObject
* @param string $label Label to use for status for added status * @param string $label Label to use for status for added status
* @return string Libelle * @return string Libelle
*/ */
function getLibProspCommStatut($mode=0, $label='') public function getLibProspCommStatut($mode = 0, $label = '')
{ {
return $this->LibProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto); return $this->libProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto);
} }
/** /**
@ -1862,7 +1862,7 @@ class Contact extends CommonObject
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Libelle du statut * @return string Libelle du statut
*/ */
function LibProspCommStatut($statut, $mode=0, $label='', $picto='') public function libProspCommStatut($statut, $mode = 0, $label = '', $picto = '')
{ {
global $langs; global $langs;
$langs->load('customers'); $langs->load('customers');

View File

@ -93,7 +93,7 @@ $search_import_key = GETPOST("search_import_key", "alpha");
$search_country = GETPOST("search_country", 'intcomma'); $search_country = GETPOST("search_country", 'intcomma');
$search_roles = GETPOST("search_roles", 'array'); $search_roles = GETPOST("search_roles", 'array');
$search_level = GETPOST("search_level", "array"); $search_level = GETPOST("search_level", "array");
$search_stcomm = GETPOST('search_stcomm','int'); $search_stcomm = GETPOST('search_stcomm', 'int');
if ($search_status == '') $search_status = 1; // always display active customer first if ($search_status == '') $search_status = 1; // always display active customer first
@ -1010,23 +1010,22 @@ while ($i < min($num, $limit))
print '<td class="center">'; print '<td class="center">';
print $contactstatic->getLibProspLevel(); print $contactstatic->getLibProspLevel();
print "</td>"; print "</td>";
if (! $i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['p.fk_stcommcontact']['checked'])) if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
{ {
// Prospect status // Prospect status
print '<td class="center nowrap"><div class="nowrap">'; print '<td class="center nowrap"><div class="nowrap">';
print '<div class="inline-block">'.$contactstatic->LibProspCommStatut($obj->stcomm_id,2,$contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); print '<div class="inline-block">' . $contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '</div> - <div class="inline-block">'; print '</div> - <div class="inline-block">';
foreach($contactstatic->cacheprospectstatus as $key => $val) foreach ($contactstatic->cacheprospectstatus as $key => $val) {
{ $titlealt = 'default';
$titlealt='default'; if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommcontactid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommcontactid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code'],$val['picto']).'</a>';
} }
print '</div></div></td>'; print '</div></div></td>';
if (! $i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Extra fields // Extra fields

View File

@ -179,32 +179,35 @@ class FormCompany extends Form
* @param int $empty Add empty value in list * @param int $empty Add empty value in list
* @return void * @return void
*/ */
function form_prospect_contact_level($page, $selected='', $htmlname='prospect_contact_level_id', $empty=0) function form_prospect_contact_level($page, $selected = '', $htmlname = 'prospect_contact_level_id', $empty = 0)
{ {
global $user, $langs; global $user, $langs;
print '<form method="post" action="'.$page.'">'; print '<form method="post" action="' . $page . '">';
print '<input type="hidden" name="action" value="setprospectcontactlevel">'; print '<input type="hidden" name="action" value="setprospectcontactlevel">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="' . newToken() . '">';
dol_syslog(__METHOD__,LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$sql = "SELECT code, label"; $sql = "SELECT code, label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectcontactlevel";
$sql.= " WHERE active > 0"; $sql .= " WHERE active > 0";
$sql.= " ORDER BY sortorder"; $sql .= " ORDER BY sortorder";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$options = array(); $options = array();
if ($empty) { if ($empty)
{
$options[''] = ''; $options[''] = '';
} }
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql))
{
$level = $langs->trans($obj->code); $level = $langs->trans($obj->code);
if ($level == $obj->code) { if ($level == $obj->code)
{
$level = $langs->trans($obj->label); $level = $langs->trans($obj->label);
} }
@ -214,8 +217,8 @@ class FormCompany extends Form
print Form::selectarray($htmlname, $options, $selected); print Form::selectarray($htmlname, $options, $selected);
} }
else dol_print_error($this->db); else dol_print_error($this->db);
if (! empty($htmlname) && $user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if (!empty($htmlname) && $user->admin) print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
print '</form>'; print '</form>';
} }

View File

@ -3447,7 +3447,7 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Return an img tag * @return string Return an img tag
*/ */
function img_action($titlealt, $numaction, $picto='') function img_action($titlealt, $numaction, $picto = '')
{ {
global $langs; global $langs;

View File

@ -3984,7 +3984,7 @@ class Societe extends CommonObject
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Label of prospection status * @return string Label of prospection status
*/ */
public function LibProspCommStatut($status, $mode = 0, $label = '', $picto='') public function LibProspCommStatut($status, $mode = 0, $label = '', $picto = '')
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;