From 4c3f9d6d5e1b5f86cfbe2cf2016e626b6387f580 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 18 May 2018 15:20:16 +0200 Subject: [PATCH 1/7] FIX : test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url --- htdocs/compta/facture/card.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d79b8d0bae5..9d5cc64c2a4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -186,13 +186,17 @@ if (empty($reshook)) $qualified_for_stock_change = $object->hasProductsOrServices(1); } - $result = $object->delete($user, 0, $idwarehouse); - if ($result > 0) { - header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php'); - exit(); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; + if($object->is_erasable()) { + + $result = $object->delete($user, 0, $idwarehouse); + if ($result > 0) { + header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php'); + exit(); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $action=''; + } + } } From 8e397b772f87bf123ded6523d49f0611a22cbbdd Mon Sep 17 00:00:00 2001 From: Sean Wang Date: Mon, 21 May 2018 14:19:41 +0800 Subject: [PATCH 2/7] Fix sql error --- htdocs/accountancy/class/accountingaccount.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 3f5c11691ad..3544f98d418 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -202,9 +202,9 @@ class AccountingAccount extends CommonObject $sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); $sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'"); $sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'"); - $sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'"); + $sql .= ", " . (empty($this->account_parent) ? '0' : "'" . $this->db->escape($this->account_parent) . "'"); $sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); - $sql .= ", " . (empty($this->account_category) ? '0' : $this->db->escape($this->account_category)); + $sql .= ", " . (empty($this->account_category) ? 0 : $this->db->escape($this->account_category)); $sql .= ", " . $user->id; $sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active)); $sql .= ")"; From c9222adf6d0cc70bd562324d3f1486c9472bb3d9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Mon, 21 May 2018 16:22:06 +0200 Subject: [PATCH 3/7] FIX: shipment: fk_proje(c)t not handled in fetch() and update() methods --- htdocs/expedition/class/expedition.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bccfba4446d..0c4232fabee 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -481,7 +481,7 @@ class Expedition extends CommonObject // Check parameters if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, 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_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery"; $sql.= ", e.fk_shipping_method, e.tracking_number"; @@ -513,6 +513,7 @@ class Expedition extends CommonObject $this->ref_ext = $obj->ref_ext; $this->ref_int = $obj->ref_int; $this->statut = $obj->fk_statut; + $this->fk_project = $obj->fk_projet; $this->user_author_id = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated @@ -1052,6 +1053,7 @@ class Expedition extends CommonObject $sql.= " fk_shipping_method=".((isset($this->shipping_method_id) && $this->shipping_method_id > 0)?$this->shipping_method_id:"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; + $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").","; $sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").","; $sql.= " width=".(($this->trueWidth != '')?$this->trueWidth:"null").","; $sql.= " size_units=".(isset($this->size_units)?$this->size_units:"null").","; From 734ecbc9b5051aff233f73cdc8910e94a791dc6b Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Wed, 23 May 2018 09:47:29 +0200 Subject: [PATCH 4/7] FIX : Fetch shipping will now fetch project id --- htdocs/expedition/class/expedition.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bccfba4446d..fa16f7f6ae5 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -487,7 +487,7 @@ class Expedition extends CommonObject $sql.= ", e.fk_shipping_method, e.tracking_number"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= ", e.note_private, e.note_public"; - $sql.= ', e.fk_incoterms, e.location_incoterms'; + $sql.= ', e.fk_incoterms, e.location_incoterms, e.fk_projet'; $sql.= ', i.libelle as libelle_incoterms'; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; @@ -526,6 +526,7 @@ class Expedition extends CommonObject $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin_id = $obj->origin_id; $this->billed = ($obj->fk_statut==2?1:0); + $this->fk_project = $obj->fk_projet; $this->trueWeight = $obj->weight; $this->weight_units = $obj->weight_units; From eb224e43a5d67d3656f547da822704e802a04b4d Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 24 May 2018 10:41:24 +0200 Subject: [PATCH 5/7] FIX missing filters during ordering --- htdocs/comm/propal/list.php | 1 + htdocs/commande/list.php | 7 +++++++ htdocs/compta/facture/list.php | 3 +++ htdocs/expedition/list.php | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 480ad7f4fda..72491e90e3e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -384,6 +384,7 @@ if ($resql) if ($search_zip) $param.='&search_zip='.urlencode($search_zip); if ($socid > 0) $param.='&socid='.urlencode($socid); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_product_category != '') $param.='&search_product_category='.$search_product_category; // Add $param from extra fields foreach ($search_array_options as $key => $val) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 86a5f463840..6284e53aa5c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -627,6 +627,13 @@ if ($resql) if ($show_files) $param.='&show_files=' .$show_files; if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($billed != '') $param.='&billed='.$billed; + if ($search_town != '')$param .= '&search_town='.$search_town; + if ($search_zip != '')$param .= '&search_zip='.$search_zip; + if ($search_state != '')$param .= '&search_state='.$search_state; + if ($search_country != '')$param .= '&search_country='.$search_country; + if ($search_type_thirdparty != '')$param .= '&search_type_thirdparty='.$search_type_thirdparty; + if ($search_product_category != '')$param .= '&search_product_category='.$search_product_category; + // Add $param from extra fields foreach ($search_array_options as $key => $val) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d7f9384399f..994f1d93569 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -563,6 +563,9 @@ if ($resql) if ($show_files) $param.='&show_files=' .$show_files; if ($option) $param.="&option=".$option; if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($search_town)$param .= '&search_town='.urlencode($search_town); + if ($search_zip)$param .= '&search_zip='.urlencode($search_zip); + // Add $param from extra fields foreach ($search_array_options as $key => $val) { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 1a712b66650..819d4337788 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -51,6 +51,7 @@ $search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_billed=GETPOST("search_billed",'int'); $sall = GETPOST('sall', 'alphanohtml'); $optioncss = GETPOST('optioncss','alpha'); +$search_ref_customer=GETPOST("search_ref_customer"); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); @@ -141,6 +142,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_billed=''; $viewstatut=''; $search_array_options=array(); + $search_ref_customer=''; } if (empty($reshook)) @@ -267,6 +269,10 @@ if ($resql) if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; if ($search_company) $param.= "&search_company=".$search_company; if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($search_town)$param .= '&search_town='.urlencode($search_town); + if ($search_zip)$param .= '&search_zip='.urlencode($search_zip); + if ($search_ref_customer)$param .= '&search_ref_customer='.$search_ref_customer; + if ($viewstatut != '')$param .= '&viewstatut='.$viewstatut; // Add $param from extra fields foreach ($search_array_options as $key => $val) { From 1b237a75b9411b270664b874a7650d8d6947fa29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Thu, 24 May 2018 13:31:23 +0200 Subject: [PATCH 6/7] Update card.php --- htdocs/comm/action/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index b89263bae01..eba1d77a03f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -417,6 +417,7 @@ if ($action == 'update') $object->location = GETPOST('location'); $object->socid = GETPOST("socid"); $socpeopleassigned = GETPOST("socpeopleassigned",'array'); + $object->socpeopleassigned = array(); foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid); $object->contactid = GETPOST("contactid",'int'); $object->fk_project = GETPOST("projectid",'int'); From 0a581e48d47cb8c0a5aa565006beae35a753b4a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 May 2018 11:04:04 +0200 Subject: [PATCH 7/7] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9d5cc64c2a4..06330de7682 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -186,7 +186,7 @@ if (empty($reshook)) $qualified_for_stock_change = $object->hasProductsOrServices(1); } - if($object->is_erasable()) { + if ($object->is_erasable()) { $result = $object->delete($user, 0, $idwarehouse); if ($result > 0) {