mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge branch 'develop' into 13.0_fix_sellist_add_order_by_option
This commit is contained in:
@@ -49,7 +49,7 @@ class MyObject extends CommonObject
|
||||
public $table_element = 'mymodule_myobject';
|
||||
|
||||
/**
|
||||
* @var int Does this object support multicompany module ?
|
||||
* @var int Does this object support multicompany module ?
|
||||
* 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
|
||||
*/
|
||||
public $ismultientitymanaged = 0;
|
||||
@@ -429,7 +429,7 @@ class MyObject extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Load list of objects in memory from the database.
|
||||
* Load list of objects in memory from the database. Using a fetchAll is a bad practice, instead try to forge you optimized and limited SQL request.
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
@@ -448,6 +448,9 @@ class MyObject extends CommonObject
|
||||
$sql = "SELECT ";
|
||||
$sql .= $this->getFieldList('t');
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
if (isset($this->isextrafieldmanaged) && $this->isextrafieldmanaged == 1) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix().$this->table_element."_extrafields as te ON tf.fk_object = t.rowid";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
$sql .= " WHERE t.entity IN (".getEntity($this->element).")";
|
||||
} else {
|
||||
@@ -462,7 +465,7 @@ class MyObject extends CommonObject
|
||||
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
|
||||
} elseif ($key == 'customsql') {
|
||||
$sqlwhere[] = $value;
|
||||
$sqlwhere[] = $value; // For this case, $value never come from a user input but is a hard coded value in code
|
||||
} elseif (strpos($value, '%') === false) {
|
||||
$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
|
||||
} else {
|
||||
@@ -812,7 +815,7 @@ class MyObject extends CommonObject
|
||||
if ($option !== 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
$add_save_lastsearch_values = 1;
|
||||
}
|
||||
if ($url && $add_save_lastsearch_values) {
|
||||
|
||||
Reference in New Issue
Block a user