From 4dd42496fa0278160c9748f1993345f169c78450 Mon Sep 17 00:00:00 2001 From: kamel Date: Mon, 27 Apr 2020 17:48:05 +0200 Subject: [PATCH] Correction pour validation Stickler CI / stickler-ci --- htdocs/comm/card.php | 8 ++-- htdocs/contact/card.php | 24 +++++------ htdocs/contact/class/contact.class.php | 56 +++++++++++++------------- htdocs/contact/list.php | 20 ++++----- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index c243a1f05d3..8a42c0f3ae6 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -562,10 +562,10 @@ if ($object->id > 0) print '
'; foreach ($object->cacheprospectstatus as $key => $val) { - $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 ($object->stcomm_id != $val['id']) print ''.img_action($titlealt, $val['code'],$val['picto']).''; - } + $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 ($object->stcomm_id != $val['id']) print '' . img_action($titlealt, $val['code'], $val['picto']) . ''; + } print '
'; print ""; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 4c7deddca18..8534094c075 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -485,10 +485,10 @@ if (empty($reshook)) } if ($action == 'setprospectcontactlevel' && $user->rights->societe->contact->creer) - { + { $object->fetch($id); - $object->fk_prospectlevel=GETPOST('prospect_contact_level_id','alpha'); - $result=$object->update($object->id, $user); + $object->fk_prospectlevel = GETPOST('prospect_contact_level_id', 'alpha'); + $result = $object->update($object->id, $user); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } @@ -496,8 +496,8 @@ if (empty($reshook)) if ($action == 'setstcomm') { $object->fetch($id); - $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcommcontact'); - $result=$object->update($object->id, $user); + $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact'); + $result = $object->update($object->id, $user); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } @@ -1411,12 +1411,12 @@ else print ''; + if ($action != 'editlevel' && $user->rights->societe->contact->creer) print ''; print '
'; print $langs->trans('ProspectLevel'); print ''; - if ($action != 'editlevel' && $user->rights->societe->contact->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'id . '">' . img_edit($langs->trans('Modify'), 1) . '
'; print ''; if ($action == 'editlevel') { - $formcompany->form_prospect_contact_level($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_prospectlevel,'prospect_contact_level_id',1); + $formcompany->form_prospect_contact_level($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_prospectlevel, 'prospect_contact_level_id', 1); } else { @@ -1427,14 +1427,14 @@ else // Status $object->loadCacheOfProspStatus(); - print ''.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']); + print '' . $langs->trans("StatusProsp") . '' . $object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']); print '     '; print '
'; - foreach($object->cacheprospectstatus as $key => $val) + foreach ($object->cacheprospectstatus as $key => $val) { - $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 ($object->stcomm_id != $val['id']) print ''.img_action($titlealt,$val['code'],$val['picto']).''; + $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 ($object->stcomm_id != $val['id']) print '' . img_action($titlealt, $val['code'], $val['picto']) . ''; } print '
'; print ""; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 2b9647641fd..2eec5c5a880 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1781,15 +1781,15 @@ class Contact extends CommonObject { global $langs; - $sql="SELECT id, code, libelle as label, picto FROM ".MAIN_DB_PREFIX."c_stcommcontact"; - if ($active >= 0) $sql.=" WHERE active = ".$active; - $resql=$this->db->query($sql); - $num=$this->db->num_rows($resql); - $i=0; + $sql = "SELECT id, code, libelle as label, picto FROM " . MAIN_DB_PREFIX . "c_stcommcontact"; + if ($active >= 0) $sql .= " WHERE active = " . $active; + $resql = $this->db->query($sql); + $num = $this->db->num_rows($resql); + $i = 0; while ($i < $num) { - $obj=$this->db->fetch_object($resql); - $this->cacheprospectstatus[$obj->id]=array('id'=>$obj->id, 'code'=>$obj->code, 'label'=>($langs->trans("ST_".strtoupper($obj->code))=="ST_".strtoupper($obj->code))?$obj->label:$langs->trans("ST_".strtoupper($obj->code)), 'picto'=>$obj->picto); + $obj = $this->db->fetch_object($resql); + $this->cacheprospectstatus[$obj->id] = array('id' => $obj->id, 'code' => $obj->code, 'label' => ($langs->trans("ST_" . strtoupper($obj->code)) == "ST_" . strtoupper($obj->code)) ? $obj->label : $langs->trans("ST_" . strtoupper($obj->code)), 'picto' => $obj->picto); $i++; } return 1; @@ -1815,11 +1815,11 @@ class Contact extends CommonObject { global $langs; - $lib=$langs->trans("ProspectLevel".$fk_prospectlevel); + $lib = $langs->trans("ProspectLevel" . $fk_prospectlevel); // If lib not found in language file, we get label from cache/databse - if ($lib == $langs->trans("ProspectLevel".$fk_prospectlevel)) + if ($lib == $langs->trans("ProspectLevel" . $fk_prospectlevel)) { - $lib=$langs->getLabelFromKey($this->db,$fk_prospectlevel,'c_prospectlevel','code','label'); + $lib = $langs->getLabelFromKey($this->db, $fk_prospectlevel, 'c_prospectlevel', 'code', 'label'); } return $lib; } @@ -1869,38 +1869,38 @@ class Contact extends CommonObject if ($mode == 2) { - if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"),-1, $picto).' '.$langs->trans("StatusProspect-1"); - elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto).' '.$langs->trans("StatusProspect0"); - elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto).' '.$langs->trans("StatusProspect1"); - elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto).' '.$langs->trans("StatusProspect2"); - elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto).' '.$langs->trans("StatusProspect3"); + if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1"); + elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0"); + elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1"); + elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2"); + elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3"); else { - return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0, $picto).' '.(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label); + return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label); } } if ($mode == 3) { - if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"),-1, $picto); - elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto); - elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto); - elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto); - elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto); + if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto); + elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto); + elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto); + elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto); + elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto); else { - return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0, $picto); + return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto); } } if ($mode == 4) { - if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"),-1, $picto).' '.$langs->trans("StatusProspect-1"); - elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto).' '.$langs->trans("StatusProspect0"); - elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto).' '.$langs->trans("StatusProspect1"); - elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto).' '.$langs->trans("StatusProspect2"); - elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto).' '.$langs->trans("StatusProspect3"); + if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1"); + elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0"); + elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1"); + elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2"); + elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3"); else { - return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0, $picto).' '.(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label); + return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label); } } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 14e3586fd3b..eb681385973 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -92,8 +92,8 @@ $search_town = GETPOST('search_town', 'alpha'); $search_import_key = GETPOST("search_import_key", "alpha"); $search_country = GETPOST("search_country", 'intcomma'); $search_roles = GETPOST("search_roles", 'array'); -$search_level = GETPOST("search_level", "array"); -$search_stcomm=GETPOST('search_stcomm','int'); +$search_level = GETPOST("search_level", "array"); +$search_stcomm = GETPOST('search_stcomm','int'); if ($search_status == '') $search_status = 1; // always display active customer first @@ -286,12 +286,12 @@ if (empty($reshook)) if ($action == 'setstcomm') { $object = new Contact($db); - $result=$object->fetch(GETPOST('stcommcontactid')); - $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcommcontact'); - $result=$object->update($object->id, $user); - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); + $result = $object->fetch(GETPOST('stcommcontactid')); + $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact'); + $result = $object->update($object->id, $user); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - $action=''; + $action = ''; } } @@ -363,7 +363,7 @@ if (!empty($userid)) // propre au commercial $sql .= " AND p.fk_user_creat=".$db->escape($userid); } if ($search_level) $sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3); -if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("p.fk_stcommcontact",$search_stcomm,2); +if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2); // Filter to exclude not owned private contacts if ($search_priv != '0' && $search_priv != '1') @@ -820,8 +820,8 @@ if (!empty($conf->socialnetworks->enabled)) { } if (!empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); if (!empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); -if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'],$_SERVER["PHP_SELF"],"p.fk_prospectcontactlevel","",$param,'',$sortfield,$sortorder, 'center '); -if (! empty($arrayfields['p.fk_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'],$_SERVER["PHP_SELF"],"p.fk_stcommcontact","",$param,'',$sortfield,$sortorder, 'center '); +if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields