diff --git a/ChangeLog b/ChangeLog index 28c424736d0..8a7c97adf97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,7 +28,8 @@ For developers: - Renamed some database fields, code variables and parameters from french to english. - First change to manage margins on contracts. - Add hook getFormMail. - +- Function plimit of databases drivers accept -1 as value (it means default value set + into conf->liste_limit). For translators: - Update language files. diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index cfa8e858f70..f8eb9914cf7 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -499,16 +499,16 @@ class DoliDBMssql /** - * Define limits of request - * - * @param int $limit nombre maximum de lignes retournees - * @param int $offset numero de la ligne a partir de laquelle recuperer les ligne - * @return string chaine exprimant la syntax sql de la limite + * Define limits and offset of request + * + * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) + * @param int $offset Numero of line from where starting fetch + * @return string String with SQL syntax to add a limit and offset */ function plimit($limit=0,$offset=0) { global $conf; - if (! $limit) $limit=$conf->liste_limit; + if ($limit < 0) $limit=$conf->liste_limit; if ($offset > 0) return " LIMIT $offset,$limit "; else return " LIMIT $limit "; } diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 81d5d7de4ff..7b22c8165c3 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -479,16 +479,16 @@ class DoliDBMysql /** - * Define limits of request - * - * @param int $limit nombre maximum de lignes retournees - * @param int $offset numero de la ligne a partir de laquelle recuperer les ligne - * @return string chaine exprimant la syntax sql de la limite + * Define limits and offset of request + * + * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) + * @param int $offset Numero of line from where starting fetch + * @return string String with SQL syntax to add a limit and offset */ function plimit($limit=0,$offset=0) { global $conf; - if (! $limit) $limit=$conf->liste_limit; + if ($limit < 0) $limit=$conf->liste_limit; if ($offset > 0) return " LIMIT $offset,$limit "; else return " LIMIT $limit "; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 5ccdb661ec2..6ea19ba8c11 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -481,16 +481,16 @@ class DoliDBMysqli /** - * Defini les limites de la requete + * Define limits and offset of request * - * @param int $limit nombre maximum de lignes retournees - * @param int $offset numero de la ligne a partir de laquelle recuperer les ligne - * @return string chaine exprimant la syntax sql de la limite + * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) + * @param int $offset Numero of line from where starting fetch + * @return string String with SQL syntax to add a limit and offset */ function plimit($limit=0,$offset=0) { global $conf; - if (! $limit) $limit=$conf->liste_limit; + if ($limit < 0) $limit=$conf->liste_limit; if ($offset > 0) return " LIMIT $offset,$limit "; else return " LIMIT $limit "; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 2c05625e383..df73e562e70 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -691,16 +691,16 @@ class DoliDBPgsql /** - * Defini les limites de la requete - * - * @param int $limit nombre maximum de lignes retournees - * @param int $offset numero de la ligne a partir de laquelle recuperer les lignes - * @return string chaine exprimant la syntax sql de la limite + * Define limits and offset of request + * + * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) + * @param int $offset Numero of line from where starting fetch + * @return string String with SQL syntax to add a limit and offset */ function plimit($limit=0,$offset=0) { global $conf; - if (! $limit) $limit=$conf->liste_limit; + if ($limit < 0) $limit=$conf->liste_limit; if ($offset > 0) return " LIMIT ".$limit." OFFSET ".$offset." "; else return " LIMIT $limit "; } diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 4cc217d24ad..8725e9a3efe 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -620,16 +620,16 @@ class DoliDBSqlite /** - * Define limits of request - * - * @param int $limit nombre maximum de lignes retournees - * @param int $offset numero de la ligne a partir de laquelle recuperer les ligne - * @return string chaine exprimant la syntax sql de la limite + * Define limits and offset of request + * + * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) + * @param int $offset Numero of line from where starting fetch + * @return string String with SQL syntax to add a limit and offset */ function plimit($limit=0,$offset=0) { global $conf; - if (! $limit) $limit=$conf->liste_limit; + if ($limit < 0) $limit=$conf->liste_limit; if ($offset > 0) return " LIMIT $offset,$limit "; else return " LIMIT $limit "; }