diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fb35d337bac..d38052b684c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -200,7 +200,7 @@ class Propal extends CommonObject $line->remise_percent=$remise_percent; $line->tva_tx=$tva_tx; - $this->products[]=$line; + $this->lines[]=$line; } } @@ -1302,9 +1302,6 @@ class Propal extends CommonObject $soc = new Societe($this->db); $soc->fetch($this->socid); - // Class of company linked to propal - $result=$soc->set_as_client(); - // Define new ref if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref))) { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 5420357a5a9..3f7dd507afc 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -92,15 +92,17 @@ class FormCompany * Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre) * * @param int $mode 0=renvoi id+libelle, 1=renvoi code+libelle + * @param string $filter Add a SQL filter to select * @return array Array of types d'effectifs */ - function effectif_array($mode=0) + function effectif_array($mode=0, $filter='') { $effs = array(); $sql = "SELECT id, code, libelle"; $sql .= " FROM ".MAIN_DB_PREFIX."c_effectif"; $sql.= " WHERE active = 1"; + if ($filter) $sql.=" ".$filter; $sql .= " ORDER BY id ASC"; dol_syslog(get_class($this).'::effectif_array sql='.$sql,LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 8100d526718..08d520d519e 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -266,7 +266,7 @@ class Link extends CommonObject { while ($obj = $this->db->fetch_object($resql)) { - $link = new Link($db); + $link = new Link($this->db); $link->id = $obj->rowid; $link->entity = $obj->entity; $link->datea = $this->db->jdate($obj->datea); diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index f85aa4ca78a..aa0792c5970 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -125,6 +125,71 @@ abstract class DoliDB implements Database } } + /** + * Validate a database transaction + * + * @param string $log Add more log to default log line + * @return int 1 if validation is OK or transaction level no started, 0 if ERROR + */ + function commit($log='') + { + dol_syslog('',0,-1); + if ($this->transaction_opened<=1) + { + $ret=$this->query("COMMIT"); + if ($ret) + { + $this->transaction_opened=0; + dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG); + } + return $ret; + } + else + { + $this->transaction_opened--; + return 1; + } + } + + /** + * Annulation d'une transaction et retour aux anciennes valeurs + * + * @param string $log Add more log to default log line + * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur + */ + function rollback($log='') + { + dol_syslog('',0,-1); + if ($this->transaction_opened<=1) + { + $ret=$this->query("ROLLBACK"); + $this->transaction_opened=0; + dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG); + return $ret; + } + else + { + $this->transaction_opened--; + return 1; + } + } + + /** + * 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 (empty($limit)) return ""; + if ($limit < 0) $limit=$conf->liste_limit; + if ($offset > 0) return " LIMIT $offset,$limit "; + else return " LIMIT $limit "; + } + /** * Return version of database server into an array * diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 239582a6595..855b7a71026 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -466,24 +466,6 @@ class DoliDBMssql extends DoliDB if (is_resource($resultset)) mssql_free_result($resultset); } - - /** - * 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 (empty($limit)) return ""; - if ($limit < 0) $limit=$conf->liste_limit; - if ($offset > 0) return " LIMIT $offset,$limit "; - else return " LIMIT $limit "; - } - - /** * Escape a string to insert data * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 582adbb343a..efe942caed5 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -239,55 +239,6 @@ class DoliDBMysql extends DoliDB return false; } - /** - * Validate a database transaction - * - * @param string $log Add more log to default log line - * @return int 1 if validation is OK or transaction level no started, 0 if ERROR - */ - function commit($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("COMMIT"); - if ($ret) - { - $this->transaction_opened=0; - dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG); - } - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - - /** - * Annulation d'une transaction et retour aux anciennes valeurs - * - * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur - */ - function rollback($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("ROLLBACK"); - $this->transaction_opened=0; - dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG); - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - /** * Execute a SQL request and return the resultset * @@ -414,24 +365,6 @@ class DoliDBMysql extends DoliDB if (is_resource($resultset)) mysql_free_result($resultset); } - - /** - * 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 (empty($limit)) return ""; - if ($limit < 0) $limit=$conf->liste_limit; - if ($offset > 0) return " LIMIT $offset,$limit "; - else return " LIMIT $limit "; - } - - /** * Escape a string to insert data * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 66fa531bf09..f2dd2e80359 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -243,55 +243,6 @@ class DoliDBMysqli extends DoliDB return false; } - /** - * Validate a database transaction - * - * @param string $log Add more log to default log line - * @return int 1 if validation is OK or transaction level no started, 0 if ERROR - */ - function commit($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("COMMIT"); - if ($ret) - { - $this->transaction_opened=0; - dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG); - } - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - - /** - * Annulation d'une transaction et retour aux anciennes valeurs - * - * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur - */ - function rollback($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("ROLLBACK"); - $this->transaction_opened=0; - dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG); - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - /** * Execute a SQL request and return the resultset * @@ -425,24 +376,6 @@ class DoliDBMysqli extends DoliDB if (is_object($resultset)) mysqli_free_result($resultset); } - - /** - * 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 (empty($limit)) return ""; - if ($limit < 0) $limit=$conf->liste_limit; - if ($offset > 0) return " LIMIT $offset,$limit "; - else return " LIMIT $limit "; - } - - /** * Escape a string to insert data * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index f8cb36e4044..9ed44faf548 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -448,82 +448,6 @@ class DoliDBPgsql extends DoliDB return false; } - /** - * Start transaction - * - * @return int 1 if transaction successfuly opened or already opened, 0 if error - */ - function begin() - { - if (! $this->transaction_opened) - { - $ret=$this->query("BEGIN;"); - if ($ret) - { - $this->transaction_opened++; - dol_syslog("BEGIN Transaction",LOG_DEBUG); - dol_syslog('',0,1); - } - return $ret; - } - else - { - $this->transaction_opened++; - dol_syslog('',0,1); - return 1; - } - } - - /** - * Validate a database transaction - * - * @param string $log Add more log to default log line - * @return int 1 if validation is OK or transaction level no started, 0 if ERROR - */ - function commit($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("COMMIT;"); - if ($ret) - { - $this->transaction_opened=0; - dol_syslog("COMMIT Transaction",LOG_DEBUG); - } - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - - /** - * Annulation d'une transaction et retour aux anciennes valeurs - * - * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur - */ - function rollback($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("ROLLBACK;"); - $this->transaction_opened=0; - dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG); - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - - /** * Convert request to PostgreSQL syntax, execute it and return the resultset * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index fe3ac4718a9..8c3e9fa9df3 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -368,55 +368,6 @@ class DoliDBSqlite extends DoliDB return false; } - /** - * Validate a database transaction - * - * @param string $log Add more log to default log line - * @return int 1 if validation is OK or transaction level no started, 0 if ERROR - */ - function commit($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("COMMIT"); - if ($ret) - { - $this->transaction_opened=0; - dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG); - } - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - - /** - * Annulation d'une transaction et retour aux anciennes valeurs - * - * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur - */ - function rollback($log='') - { - dol_syslog('',0,-1); - if ($this->transaction_opened<=1) - { - $ret=$this->query("ROLLBACK"); - $this->transaction_opened=0; - dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG); - return $ret; - } - else - { - $this->transaction_opened--; - return 1; - } - } - /** * Execute a SQL request and return the resultset * @@ -559,24 +510,6 @@ class DoliDBSqlite extends DoliDB if (is_object($resultset)) $resultset->closeCursor(); } - - /** - * 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 (empty($limit)) return ""; - if ($limit < 0) $limit=$conf->liste_limit; - if ($offset > 0) return " LIMIT $offset,$limit "; - else return " LIMIT $limit "; - } - - /** * Escape a string to insert data * diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index a9b7f9e4c18..b6b5993b9d4 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -554,7 +554,9 @@ function newpopup(url,title) { tmp=url; var l = (argc > 2) ? argv[2] : 600; var h = (argc > 3) ? argv[3] : 400; - var wfeatures="directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width="+l+",height="+h+",left=" + eval("(screen.width - l)/2") + ",top=" + eval("(screen.height - h)/2"); + var left = (screen.width - l)/2; + var top = (screen.height - h)/2; + var wfeatures = "directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width=" + l +",height=" + h + ",left=" + left + ",top=" + top; fen=window.open(tmp,title,wfeatures); return false; }