Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.47k stars 2.8k forks source link

SQL Error on 17.0.0-alpha fresh install #22371

Closed moert-dev closed 2 years ago

moert-dev commented 2 years ago

Bug

On step 2 of a fresh installation the response from the server is a syntax db error:

SQL Error DB_ERROR_SYNTAX You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fk_default_workstation integer DEFAULT NULL )ENGINE=innodb' at line 88

create table db_product ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(128) NOT NULL, entity integer DEFAULT 1 NOT NULL, ref_ext varchar(128), datec datetime, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_parent integer DEFAULT 0, label varchar(255) NOT NULL, description text, note_public text, note text, customcode varchar(32), fk_country integer DEFAULT NULL, fk_state integer DEFAULT NULL, price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, price_min_ttc double(24,8) DEFAULT 0, price_base_type varchar(3) DEFAULT 'HT', cost_price double(24,8) DEFAULT NULL, default_vat_code varchar(10), tva_tx double(7,4), recuperableonly integer NOT NULL DEFAULT '0', localtax1_tx double(7,4) DEFAULT 0, localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax2_tx double(7,4) DEFAULT 0, localtax2_type varchar(10) NOT NULL DEFAULT '0', fk_user_author integer DEFAULT NULL, fk_user_modif integer, tosell tinyint DEFAULT 1, tobuy tinyint DEFAULT 1, onportal tinyint DEFAULT 0, tobatch tinyint DEFAULT 0 NOT NULL, sell_or_eat_by_mandatory tinyint DEFAULT 0 NOT NULL, batch_mask varchar(32) DEFAULT NULL, fk_product_type integer DEFAULT 0, duration varchar(6), seuil_stock_alerte float DEFAULT NULL, url varchar(255), barcode varchar(180) DEFAULT NULL, fk_barcode_type integer DEFAULT NULL, accountancy_code_sell varchar(32), accountancy_code_sell_intra varchar(32), accountancy_code_sell_export varchar(32), accountancy_code_buy varchar(32), accountancy_code_buy_intra varchar(32), accountancy_code_buy_export varchar(32), partnumber varchar(32), net_measure float DEFAULT NULL, net_measure_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, length_units tinyint DEFAULT NULL, width float DEFAULT NULL, width_units tinyint DEFAULT NULL, height float DEFAULT NULL, height_units tinyint DEFAULT NULL, surface float DEFAULT NULL, surface_units tinyint DEFAULT NULL, volume float DEFAULT NULL, volume_units tinyint DEFAULT NULL, stock real, pmp double(24,8) DEFAULT 0 NOT NULL, fifo double(24,8), lifo double(24,8), fk_default_warehouse integer DEFAULT NULL, canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, lifetime integer DEFAULT NULL, qc_frequency integer DEFAULT NULL, hidden tinyint DEFAULT 0, import_key varchar(14), model_pdf varchar(255), fk_price_expression integer, desiredstock float DEFAULT 0, fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, fk_project integer DEFAULT NULL, mandatory_period tinyint DEFAULT 0, fk_default_bom integer DEFAULT NULL fk_default_workstation integer DEFAULT NULL )ENGINE=innodb; Executed query : create table db_product ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(128) NOT NULL, entity integer DEFAULT 1 NOT NULL, ref_ext varchar(128), datec datetime, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_parent integer DEFAULT 0, label varchar(255) NOT NULL, description text, note_public text, note text, customcode varchar(32), fk_country integer DEFAULT NULL, fk_state integer DEFAULT NULL, price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, price_min_ttc double(24,8) DEFAULT 0, price_base_type varchar(3) DEFAULT 'HT', cost_price double(24,8) DEFAULT NULL, default_vat_code varchar(10), tva_tx double(7,4), recuperableonly integer NOT NULL DEFAULT '0', localtax1_tx double(7,4) DEFAULT 0, localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax2_tx double(7,4) DEFAULT 0, localtax2_type varchar(10) NOT NULL DEFAULT '0', fk_user_author integer DEFAULT NULL, fk_user_modif integer, tosell tinyint DEFAULT 1, tobuy tinyint DEFAULT 1, onportal tinyint DEFAULT 0, tobatch tinyint DEFAULT 0 NOT NULL, sell_or_eat_by_mandatory tinyint DEFAULT 0 NOT NULL, batch_mask varchar(32) DEFAULT NULL, fk_product_type integer DEFAULT 0, duration varchar(6), seuil_stock_alerte float DEFAULT NULL, url varchar(255), barcode varchar(180) DEFAULT NULL, fk_barcode_type integer DEFAULT NULL, accountancy_code_sell varchar(32), accountancy_code_sell_intra varchar(32), accountancy_code_sell_export varchar(32), accountancy_code_buy varchar(32), accountancy_code_buy_intra varchar(32), accountancy_code_buy_export varchar(32), partnumber varchar(32), net_measure float DEFAULT NULL, net_measure_units tinyint DEFAULT NULL, weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, length float DEFAULT NULL, length_units tinyint DEFAULT NULL, width float DEFAULT NULL, width_units tinyint DEFAULT NULL, height float DEFAULT NULL, height_units tinyint DEFAULT NULL, surface float DEFAULT NULL, surface_units tinyint DEFAULT NULL, volume float DEFAULT NULL, volume_units tinyint DEFAULT NULL, stock real, pmp double(24,8) DEFAULT 0 NOT NULL, fifo double(24,8), lifo double(24,8), fk_default_warehouse integer DEFAULT NULL, canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, lifetime integer DEFAULT NULL, qc_frequency integer DEFAULT NULL, hidden tinyint DEFAULT 0, import_key varchar(14), model_pdf varchar(255), fk_price_expression integer, desiredstock float DEFAULT 0, fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, fk_project integer DEFAULT NULL, mandatory_period tinyint DEFAULT 0, fk_default_bom integer DEFAULT NULL fk_default_workstation integer DEFAULT NULL )ENGINE=innodb;

The solution is a missing comma in the file: install/tables/llx_product.sql

Near the bottom of the file at line 110 ....... fk_default_bom integer DEFAULT NULL fk_default_workstation integer DEFAULT NULL )ENGINE=innodb;

Should be

....... fk_default_bom integer DEFAULT NULL, fk_default_workstation integer DEFAULT NULL )ENGINE=innodb;

Environment Version

17.0.0-alpha

Environment OS

Ubuntu 20.04

Environment Web server

Apache 2.4.41

Environment PHP

7.4

Environment Database

MYSQL 8.0.30

Environment URL(s)

/install/step2.php

Expected and actual behavior

No response

Steps to reproduce the behavior

No response

Attached files

No response

ksar-ksar commented 2 years ago

Hello,

Similar to #22307 FIX is published : #22402