From 1d09e122c0a8a92ea701f5b02a20e7bc242c06b7 Mon Sep 17 00:00:00 2001 From: eldy Date: Sun, 17 Mar 2013 14:28:57 +0100 Subject: [PATCH] Some debug with pgsql --- htdocs/admin/carrier.php | 4 +++- htdocs/expedition/class/expedition.class.php | 13 +++++++++---- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 15 +++++++++++---- htdocs/install/pgsql/functions/functions.sql | 2 +- htdocs/langs/en_US/sendings.lang | 1 + htdocs/langs/fr_FR/sendings.lang | 1 + htdocs/livraison/class/livraison.class.php | 4 ++-- 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/carrier.php b/htdocs/admin/carrier.php index 305b3f30529..612c14d2248 100644 --- a/htdocs/admin/carrier.php +++ b/htdocs/admin/carrier.php @@ -1,5 +1,7 @@ + * * 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 @@ -17,7 +19,7 @@ /** * \file htdocs/admin/carrier.php * \ingroup expedition - * \brief Page d'administration des Transporteurs + * \brief Page to setup carriers. TODO Delete this page. We mut use dictionnary instead. */ require '../main.inc.php'; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 919bac93394..cac81eda070 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -81,7 +81,9 @@ class Expedition extends CommonObject var $total_localtax1; // Total Local tax 1 var $total_localtax2; // Total Local tax 2 - + var $listmeths; // List of carriers + + /** * Constructor * @@ -1175,12 +1177,14 @@ class Expedition extends CommonObject /** * Fetch all deliveries method and return an array. Load array this->listmeths. + * * @param id $id only this carrier, all if none * @return void */ function list_delivery_methods($id='') { global $langs; + $listmeths = array(); $i=0; @@ -1220,6 +1224,7 @@ class Expedition extends CommonObject $i++; } } + else dol_print_error($this->db,''); } /** @@ -1231,8 +1236,8 @@ class Expedition extends CommonObject { if ($id=='') { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (rowid, code, libelle, description, tracking)"; - $sql.=" VALUES ('','".$this->update[code]."','".$this->update[libelle]."','".$this->update[description]."','".$this->update[tracking]."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; + $sql.=" VALUES ('".$this->update[code]."','".$this->update[libelle]."','".$this->update[description]."','".$this->update[tracking]."')"; $resql = $this->db->query($sql); } else @@ -1245,7 +1250,7 @@ class Expedition extends CommonObject $sql.= " WHERE rowid=".$id; $resql = $this->db->query($sql); } - + if ($resql < 0) dol_print_error($this->db,''); } /** diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 55e8e3af0ce..a8a57e7750d 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -12,8 +12,7 @@ -- To restrict request to Mysql version x.y use -- VMYSQLx.y -- To restrict request to Pgsql version x.y use -- VPGSQLx.y -- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- To make pk to be auto increment (postgres) VPGSQL8.2 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY; - +-- To make pk to be auto increment (postgres) VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); @@ -38,6 +37,7 @@ UPDATE llx_const set name='MAIN_INFO_SOCIETE_TOWN' where name='MAIN_INFO_SOCIETE UPDATE llx_const set name='MAIN_INFO_SOCIETE_ZIP' where name='MAIN_INFO_SOCIETE_CP'; UPDATE llx_const set name='MAIN_INFO_SOCIETE_COUNTRY' where name='MAIN_INFO_SOCIETE_PAYS'; UPDATE llx_const set name='MAIN_INFO_SOCIETE_STATE' where name='MAIN_INFO_SOCIETE_DEPARTEMENT'; +UPDATE llx_const set name='LIVRAISON_ADDON_NUMBER' where name='LIVRAISON_ADDON'; ALTER TABLE llx_user add COLUMN fk_user integer; @@ -84,9 +84,16 @@ alter table llx_societe_address CHANGE COLUMN cp zip varchar(10); ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description; -ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL; +--ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE; +--ALTER TABLE llx_c_shipment_mode ADD COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY KEY; +--ALTER TABLE llc_c_shipment_mode ADD COLUMN rowid SERIAL PRIMARY KEY; +--ALTER TABLE llx_c_shipment_mode ADD COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY KEY; + -- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY; +-- VPGSQL8.2 DROP table llx_c_shipment_mode; +-- VPGSQL8.2 CREATE TABLE llx_c_shipment_mode (rowid SERIAL PRIMARY KEY, tms timestamp, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, tracking varchar(256) NOT NULL, active integer DEFAULT 0, module varchar(32) NULL); + + ALTER TABLE llx_stock_mouvement MODIFY COLUMN value real; diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 4ffba5b8c43..0c7f39025f9 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -52,7 +52,7 @@ CREATE OR REPLACE FUNCTION dol_util_rebuild_sequences() RETURNS integer as $body CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer AS $BODY$ DECLARE mytables RECORD; BEGIN FOR mytables IN SELECT relname FROM pg_class WHERE relhastriggers IS TRUE AND relkind = 'r' AND NOT relname LIKE 'pg_%' LOOP IF DoEnable THEN EXECUTE 'ALTER TABLE ' || mytables.relname || ' ENABLE TRIGGER ALL'; ELSE EXECUTE 'ALTER TABLE ' || mytables.relname || ' DISABLE TRIGGER ALL'; END IF; END LOOP; RETURN 1; END; $BODY$ LANGUAGE 'PLPGSQL'; --- Add triggers +-- Add triggers for timestamp fields CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE 'PLPGSQL'; CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingtransaction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index a4299fb94ab..58f4a3d96b7 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -59,6 +59,7 @@ LinkToTrackYourPackage=Link to track your package ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card. RelatedShippings=Related shippings ShipmentLine=Shipment line +CarrierList=List of transporters # Sending methods SendingMethodCATCH=Catch by customer diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index a80b61649da..1df80a252e1 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -59,6 +59,7 @@ LinkToTrackYourPackage=Lien pour suivi de votre colis ShipmentCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle expédition se fait depuis la fiche commande. RelatedShippings=Expédition(s) associée(s) ShipmentLine=Ligne d'expédition +CarrierList=Liste des transporteurs # Sending methods SendingMethodCATCH=Enlèvement par le client diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index d2ecc0119ce..d5dce8c6830 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -334,10 +334,10 @@ class Livraison extends CommonObject if ($user->rights->expedition->livraison->valider) { - if (! empty($conf->global->LIVRAISON_ADDON)) + if (! empty($conf->global->LIVRAISON_ADDON_NUMBER)) { // Definition du nom de module de numerotation de commande - $modName = $conf->global->LIVRAISON_ADDON; + $modName = $conf->global->LIVRAISON_ADDON_NUMBER; if (is_readable(DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php')) {