From 4c3f9d6d5e1b5f86cfbe2cf2016e626b6387f580 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 18 May 2018 15:20:16 +0200 Subject: [PATCH 1/6] 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 c9222adf6d0cc70bd562324d3f1486c9472bb3d9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Mon, 21 May 2018 16:22:06 +0200 Subject: [PATCH 2/6] 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 be21405d219d04cd286c653f7490b9d1d1a89a1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 May 2018 19:24:56 +0200 Subject: [PATCH 3/6] Fix missing error message --- htdocs/societe/card.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 204eff383d5..d0aa719e08c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -296,7 +296,7 @@ if (empty($reshook)) if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) + if ($result < 0) { $error++; $errors = $object->errors; @@ -524,8 +524,8 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } - - + + // Customer categories association $custcats = GETPOST( 'custcats', 'array' ); $object->setCategories($custcats, 'customer'); @@ -533,7 +533,7 @@ if (empty($reshook)) // Supplier categories association $suppcats = GETPOST('suppcats', 'array'); $object->setCategories($suppcats, 'supplier'); - + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -638,10 +638,13 @@ if (empty($reshook)) $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); if ($result <= 0) { - $error = $object->error; $errors = $object->errors; + $error++; + $errors = $object->errors; + setEventMessages($object->error, $object->errors, 'errors'); } + // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) - if(!empty($user->rights->categorie->lire)){ + if(!empty($user->rights->categorie->lire)){ // Customer categories association $categories = GETPOST( 'custcats', 'array' ); $object->setCategories($categories, 'customer'); @@ -718,6 +721,7 @@ if (empty($reshook)) { $error++; $object->error .= $object->db->lasterror(); + setEventMessages($object->error, $object->errors, 'errors'); } } From 734ecbc9b5051aff233f73cdc8910e94a791dc6b Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Wed, 23 May 2018 09:47:29 +0200 Subject: [PATCH 4/6] 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/6] 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 0a581e48d47cb8c0a5aa565006beae35a753b4a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 May 2018 11:04:04 +0200 Subject: [PATCH 6/6] 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) {