From ade417855beb83857d0f5d4b6e08a67849c161ea Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Sun, 29 May 2016 13:45:26 +0200 Subject: [PATCH 1/4] Fill ref_supplier in product get_buyprice --- htdocs/product/class/product.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 50f5cd0c19a..928a7c91657 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1353,7 +1353,8 @@ class Product extends CommonObject } $this->buyprice = $obj->price; // deprecated $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id - $this->ref_fourn = $obj->ref_fourn; // Ref supplier + $this->ref_fourn = $obj->ref_fourn; // deprecated + $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $result=$obj->fk_product; return $result; From 3c42a3269034db112665efc7dc3cc6507803ee18 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 31 May 2016 23:22:15 +0200 Subject: [PATCH 2/4] FIX: #5151 --- htdocs/core/modules/modOauth.class.php | 9 ++----- .../install/mysql/tables/llx_oauth_state.sql | 25 +++++++++++++++++++ .../install/mysql/tables/llx_oauth_token.sql | 25 +++++++++++++++++++ 3 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_oauth_state.sql create mode 100644 htdocs/install/mysql/tables/llx_oauth_token.sql diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index 38ed6a37fde..47e7753f3c3 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -105,14 +105,14 @@ class modOauth extends DolibarrModules $r=0; // This is to declare the Top Menu entry: - //$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu + //$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Put 0 if this is a top menu // 'type'=>'left', // This is a Top menu entry // 'titre'=>'MenuOauth', // 'mainmenu'=>'oauth', // 'url'=>'/oauth/index.php', // 'langs'=>'oauth', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>300, - // 'enabled'=>'$conf->oauth->enabled && $leftmenu==\'admintools\'', + // 'enabled'=>'$conf->oauth->enabled && $leftmenu==\'modulesadmintools\'', // 'perms'=>'$user->rights->oauth->read', // Use 'perms'=>'1' if you want your menu with no permission rules // 'target'=>'', // 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both @@ -138,11 +138,6 @@ class modOauth extends DolibarrModules // Clean before activation $this->remove($options); - $sql = array( - "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."oauth_state (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), state varchar(128), fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;", - "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."oauth_token (rowid int(11) NOT NULL AUTO_INCREMENT, service varchar(36), token text, fk_user int(11), fk_adherent int(11), entity int(11), PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;", - ); - return $this->_init($sql,$options); } } diff --git a/htdocs/install/mysql/tables/llx_oauth_state.sql b/htdocs/install/mysql/tables/llx_oauth_state.sql new file mode 100644 index 00000000000..c6b9601fa6c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_oauth_state.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2013 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- ============================================================================ + +CREATE TABLE llx_oauth_state ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + service varchar(36), + state varchar(128), + fk_user integer, + fk_adherent integer, + entity integer +) ENGINE=InnoDB; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_oauth_token.sql b/htdocs/install/mysql/tables/llx_oauth_token.sql new file mode 100644 index 00000000000..64a905b795c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_oauth_token.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2013 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- ============================================================================ + +CREATE TABLE llx_oauth_token ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + service varchar(36), + token text, + fk_user integer, + fk_adherent integer, + entity integer +) ENGINE=InnoDB; \ No newline at end of file From ed05321438e4964fdb243fadcd5e62986b2882b1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 31 May 2016 23:24:35 +0200 Subject: [PATCH 3/4] comment don't need to be updated --- htdocs/core/modules/modOauth.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index 47e7753f3c3..fe444960b53 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -105,14 +105,14 @@ class modOauth extends DolibarrModules $r=0; // This is to declare the Top Menu entry: - //$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Put 0 if this is a top menu + //$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu // 'type'=>'left', // This is a Top menu entry // 'titre'=>'MenuOauth', // 'mainmenu'=>'oauth', // 'url'=>'/oauth/index.php', // 'langs'=>'oauth', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>300, - // 'enabled'=>'$conf->oauth->enabled && $leftmenu==\'modulesadmintools\'', + // 'enabled'=>'$conf->oauth->enabled && $leftmenu==\'admintools\'', // 'perms'=>'$user->rights->oauth->read', // Use 'perms'=>'1' if you want your menu with no permission rules // 'target'=>'', // 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both From d17a879f33e7b35c76c52182974246041add99b7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 31 May 2016 23:32:21 +0200 Subject: [PATCH 4/4] add into migratino script --- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 17 +++++++++++++++++ htdocs/install/mysql/tables/llx_oauth_state.sql | 2 +- htdocs/install/mysql/tables/llx_oauth_token.sql | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 140b0c15089..3b19ef2b2a2 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -479,6 +479,23 @@ update llx_stock_mouvement set batch = '000000' where batch = 'Undefined'; -- At end (higher risk of error) -- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT; + ALTER TABLE llx_product_batch ADD UNIQUE INDEX uk_product_batch (fk_product_stock, batch); +CREATE TABLE llx_oauth_token ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + service varchar(36), + token text, + fk_user integer, + fk_adherent integer, + entity integer +)ENGINE=InnoDB; +CREATE TABLE llx_oauth_state ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + service varchar(36), + state varchar(128), + fk_user integer, + fk_adherent integer, + entity integer +)ENGINE=InnoDB; diff --git a/htdocs/install/mysql/tables/llx_oauth_state.sql b/htdocs/install/mysql/tables/llx_oauth_state.sql index c6b9601fa6c..92cae17ef07 100644 --- a/htdocs/install/mysql/tables/llx_oauth_state.sql +++ b/htdocs/install/mysql/tables/llx_oauth_state.sql @@ -22,4 +22,4 @@ CREATE TABLE llx_oauth_state ( fk_user integer, fk_adherent integer, entity integer -) ENGINE=InnoDB; \ No newline at end of file +)ENGINE=InnoDB; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_oauth_token.sql b/htdocs/install/mysql/tables/llx_oauth_token.sql index 64a905b795c..5dd5cd0507f 100644 --- a/htdocs/install/mysql/tables/llx_oauth_token.sql +++ b/htdocs/install/mysql/tables/llx_oauth_token.sql @@ -22,4 +22,4 @@ CREATE TABLE llx_oauth_token ( fk_user integer, fk_adherent integer, entity integer -) ENGINE=InnoDB; \ No newline at end of file +)ENGINE=InnoDB; \ No newline at end of file