diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 34abbdec79f..257c2af0111 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 .= ")"; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ced465dfdb7..bcceaff32f2 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -441,8 +441,8 @@ 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_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); - + if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); + if ($search_product_category != '') $param.='&search_product_category='.$search_product_category; // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f97dbc00617..8ff8a32a9ff 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -210,7 +210,7 @@ if (empty($reshook)) $uploaddir = $conf->commande->dir_output; $trigger_name='ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - + } @@ -397,6 +397,7 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($sall) $param.='&sall='.urlencode($sall); @@ -414,13 +415,19 @@ if ($resql) if ($search_user > 0) $param.='&search_user='.urlencode($search_user); if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); - if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); - if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($search_town != '') $param.='&search_town='.urlencode($search_town); + if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); + if ($search_state != '') $param.='&search_state='.urlencode$search_state); + if ($search_country != '') $param.='&search_country='.urlencode($search_country); + if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); + if ($search_product_category != '') $param.='&search_product_category='.urlencode($search_product_category); + if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); if ($show_files) $param.='&show_files=' .urlencode($show_files); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); if ($billed != '') $param.='&billed='.urlencode($billed); - if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d441bae6d49..3ff67cac02d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -189,13 +189,16 @@ 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?restore_lastsearch_values=1'); - 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?restore_lastsearch_values=1'); + exit(); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $action=''; + } } } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b6bde6605ad..bb3cc02dce3 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -562,6 +562,8 @@ if ($resql) if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); if ($search_type != '') $param.='&search_type='.urlencode($search_type); if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); + if ($search_town) $param.='&search_town='.urlencode($search_town); + if ($search_zip) $param.='&search_zip='.urlencode($search_zip); if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dd3123930fe..fd49a6b3ac2 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -459,14 +459,14 @@ 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, e.billed"; + $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, e.billed"; $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"; - $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.= ', i.libelle as libelle_incoterms'; + $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $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)."'"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; @@ -504,6 +504,7 @@ class Expedition extends CommonObject $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin_id = $obj->origin_id; $this->billed = $obj->billed; + $this->fk_project = $obj->fk_projet; $this->trueWeight = $obj->weight; $this->weight_units = $obj->weight_units; @@ -1023,6 +1024,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").","; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index a3d44d7072a..5dd8a720fb2 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -259,13 +259,16 @@ if ($resql) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($sall) $param.= "&sall=".urlencode($sall); - if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); - if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); + if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); - if ($search_company) $param.= "&search_company=".urlencode($search_company); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_company) $param.= "&search_company=".urlencode($search_company); + if ($search_town) $param.= '&search_town='.urlencode($search_town); + if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); + if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5567b706248..01f5a13b39f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -340,12 +340,12 @@ if (empty($reshook)) if (! $error) { - $result = $object->insertExtraFields('COMPANY_MODIFY'); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } + $result = $object->insertExtraFields('COMPANY_MODIFY'); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } if ($error) $action = 'edit_extras'; @@ -674,7 +674,7 @@ if (empty($reshook)) if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); - $error++; + $error++; } // Links with users