From 1ca0083eb868282bd96822dfb38c94a0b97094d0 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 5 Nov 2020 14:30:30 +0100 Subject: [PATCH] Fix sql error reception update, tms is auto timestamp remove deprecated --- htdocs/install/mysql/tables/llx_reception.sql | 2 +- htdocs/reception/class/reception.class.php | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql index 71cc000ffc1..7989f80cf58 100644 --- a/htdocs/install/mysql/tables/llx_reception.sql +++ b/htdocs/install/mysql/tables/llx_reception.sql @@ -29,7 +29,7 @@ create table llx_reception fk_projet integer DEFAULT NULL, ref_ext varchar(30), -- reference into an external system (not used by dolibarr) - ref_int varchar(30), -- reference into an internal system (used by dolibarr to store extern id like paypal info) + ref_int varchar(30), -- reference into an internal system (deprecated) ref_supplier varchar(30), -- customer number date_creation datetime, -- date de creation diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 766db0e3479..d64c3c999a7 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos GarcĂ­a - * Copyright (C) 2014-2015 Francis Appels + * Copyright (C) 2014-2020 Francis Appels * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron @@ -223,7 +223,6 @@ class Reception extends CommonObject $sql .= "ref"; $sql .= ", entity"; $sql .= ", ref_supplier"; - $sql .= ", ref_int"; $sql .= ", date_creation"; $sql .= ", fk_user_author"; $sql .= ", date_reception"; @@ -246,7 +245,6 @@ class Reception extends CommonObject $sql .= "'(PROV)'"; $sql .= ", ".$conf->entity; $sql .= ", ".($this->ref_supplier ? "'".$this->db->escape($this->ref_supplier)."'" : "null"); - $sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null"); $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", ".$user->id; $sql .= ", ".($this->date_reception > 0 ? "'".$this->db->idate($this->date_reception)."'" : "null"); @@ -364,7 +362,7 @@ class Reception extends CommonObject // Check parameters if (empty($id) && empty($ref) && empty($ref_ext)) return -1; - $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut"; + $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.fk_user_author, e.fk_statut"; $sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql .= ", e.date_reception as date_reception, e.model_pdf, e.date_delivery"; $sql .= ", e.fk_shipping_method, e.tracking_number"; @@ -394,7 +392,6 @@ class Reception extends CommonObject $this->socid = $obj->socid; $this->ref_supplier = $obj->ref_supplier; $this->ref_ext = $obj->ref_ext; - $this->ref_int = $obj->ref_int; $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); @@ -402,7 +399,6 @@ class Reception extends CommonObject $this->date_reception = $this->db->jdate($obj->date_reception); // TODO deprecated $this->date_reception = $this->db->jdate($obj->date_reception); // Date real $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed - $this->fk_delivery_address = $obj->fk_address; $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; // deprecated $this->shipping_method_id = $obj->fk_shipping_method; @@ -777,7 +773,6 @@ class Reception extends CommonObject if (isset($this->socid)) $this->socid = trim($this->socid); if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author); if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid); - if (isset($this->fk_delivery_address)) $this->fk_delivery_address = trim($this->fk_delivery_address); if (isset($this->shipping_method_id)) $this->shipping_method_id = trim($this->shipping_method_id); if (isset($this->tracking_number)) $this->tracking_number = trim($this->tracking_number); if (isset($this->statut)) $this->statut = (int) $this->statut; @@ -787,8 +782,8 @@ class Reception extends CommonObject if (isset($this->size_units)) $this->size_units = trim($this->size_units); if (isset($this->weight_units)) $this->weight_units = trim($this->weight_units); if (isset($this->trueWeight)) $this->weight = trim($this->trueWeight); - if (isset($this->note_private)) $this->note = trim($this->note_private); - if (isset($this->note_public)) $this->note = trim($this->note_public); + if (isset($this->note_private)) $this->note_private = trim($this->note_private); + if (isset($this->note_public)) $this->note_public = trim($this->note_public); if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf); @@ -798,7 +793,6 @@ class Reception extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."reception SET"; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").","; $sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").","; $sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").","; @@ -1193,7 +1187,6 @@ class Reception extends CommonObject $this->date_reception = $now + 24 * 3600; $this->entrepot_id = 0; - $this->fk_delivery_address = 0; $this->socid = 1; $this->commande_id = 0;