Clean code
This commit is contained in:
parent
bb436e556d
commit
e2ee74f8e0
@ -1662,8 +1662,8 @@ abstract class CommonObject
|
||||
* Looks for an object with ref matching the wildcard provided
|
||||
* It does only work when $this->table_ref_field is set
|
||||
*
|
||||
* @param string $ref Wildcard
|
||||
* @return int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO
|
||||
* @param string $ref Wildcard
|
||||
* @return int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO
|
||||
*/
|
||||
public function fetchOneLike($ref)
|
||||
{
|
||||
|
||||
@ -347,8 +347,7 @@ class EmailSenderProfile extends CommonObject
|
||||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||
$sql .= ' fk_user_creat, fk_user_modif';
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.((int) $id);
|
||||
$result = $this->db->query($sql);
|
||||
@ -356,27 +355,9 @@ class EmailSenderProfile extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -925,6 +925,7 @@ class ExtraFields
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$list = $this->attribute_list[$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
|
||||
|
||||
@ -1646,6 +1646,7 @@ class FormFile
|
||||
print '</tr>'."\n";
|
||||
|
||||
// To show ref or specific information according to view to show (defined by $module)
|
||||
$object_instance = null;
|
||||
if ($modulepart == 'company') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$object_instance = new Societe($this->db);
|
||||
@ -1813,21 +1814,26 @@ class FormFile
|
||||
if (!$id && !$ref) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = 0;
|
||||
if (!empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) {
|
||||
$found = 1;
|
||||
} else {
|
||||
//print 'Fetch '.$id." - ".$ref.' class='.get_class($object_instance).'<br>';
|
||||
|
||||
if ($id) {
|
||||
$result = $object_instance->fetch($id);
|
||||
} else {
|
||||
//fetchOneLike looks for objects with wildcards in its reference.
|
||||
//It is useful for those masks who get underscores instead of their actual symbols
|
||||
//fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
|
||||
//that's why we look only into fetchOneLike when fetch returns 0
|
||||
if (!$result = $object_instance->fetch('', $ref)) {
|
||||
$result = $object_instance->fetchOneLike($ref);
|
||||
$result = 0;
|
||||
if (is_object($object_instance)) {
|
||||
if ($id) {
|
||||
$result = $object_instance->fetch($id);
|
||||
} else {
|
||||
if (!($result = $object_instance->fetch('', $ref))) {
|
||||
//fetchOneLike looks for objects with wildcards in its reference.
|
||||
//It is useful for those masks who get underscores instead of their actual symbols (because the _ had replaced a forbiddn char)
|
||||
//fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
|
||||
//that's why we look only into fetchOneLike when fetch returns 0
|
||||
// TODO Remove this part ?
|
||||
$result = $object_instance->fetchOneLike($ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,13 @@ class ActionsCardService
|
||||
public $field_list = array();
|
||||
public $list_datas = array();
|
||||
|
||||
public $id;
|
||||
public $ref;
|
||||
public $description;
|
||||
public $note;
|
||||
public $price;
|
||||
public $price_min;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -196,6 +203,7 @@ class ActionsCardService
|
||||
}
|
||||
|
||||
// Duration
|
||||
$dur = array();
|
||||
if ($this->object->duration_value > 1) {
|
||||
$dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
|
||||
} elseif ($this->object->duration_value > 0) {
|
||||
@ -286,6 +294,7 @@ class ActionsCardService
|
||||
if ($search_categ) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
}
|
||||
$fourn_id = 0;
|
||||
if (GETPOST("fourn_id", 'int') > 0) {
|
||||
$fourn_id = GETPOST("fourn_id", 'int');
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user