From cb182752cc54f85452de19f82bd9b5684bd45d22 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sun, 19 May 2013 18:47:14 +0200 Subject: [PATCH] Report divert bug fixing from 3.4 --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/action/fiche.php | 3 +++ htdocs/comm/propal.php | 6 +++++- htdocs/comm/propal/class/propal.class.php | 1 + htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/fiche.php | 6 +++++- htdocs/compta/facture.php | 4 ++++ htdocs/compta/facture/class/facture.class.php | 1 + htdocs/core/class/commonobject.class.php | 5 ++++- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/admin_extrafields_add.tpl.php | 4 ++-- htdocs/fourn/class/paiementfourn.class.php | 2 +- 12 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9b15634945e..bb30efe8ef9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -188,8 +188,8 @@ class ActionComm extends CommonObject $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").","; $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; - $sql.= " '".$this->type_id."',"; - $sql.= " '".$this->code."',"; + $sql.= (isset($this->type_id)?$this->type_id:"null").","; + $sql.= (isset($this->code)?" '".$this->code."'":"null").","; $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").","; $sql.= " '".$this->db->escape($this->note)."',"; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 8b93bf23590..3a74a2881bf 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -243,6 +243,7 @@ if ($action == 'add_action') $db->rollback(); $langs->load("errors"); $error=$langs->trans($actioncomm->error); + setEventMessage($error,'errors'); $action = 'create'; } } @@ -251,6 +252,7 @@ if ($action == 'add_action') $db->rollback(); $langs->load("errors"); $error=$langs->trans($actioncomm->error); + setEventMessage($error,'errors'); $action = 'create'; } } @@ -277,6 +279,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') else { $mesg=$actioncomm->error; + setEventMessage($mesg,'errors'); } } } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 1ad89847ea8..f39cbd9059b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1845,7 +1845,11 @@ else foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + if ($action == 'edit_extras') { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + } else { + $value=$object->array_options["options_".$key]; + } if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7dc63fdace9..c8d0bfeebde 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2554,6 +2554,7 @@ class Propal extends CommonObject $sql.= ' WHERE pt.fk_propal = '.$this->id; $sql.= ' ORDER BY pt.rang ASC, pt.rowid'; + dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 60522561346..508f9a70fc6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2834,7 +2834,7 @@ class Commande extends CommonOrder } /** - * Update value of extrafields on the proposal + * Update value of extrafields on order * * @param User $user Object user that modify * @return int <0 if ko, >0 if ok diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 816df65ea85..ee2bdcc083b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2145,7 +2145,11 @@ else foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + if ($action == 'edit_extras') { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + } else { + $value=$object->array_options["options_".$key]; + } if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 82205be3e7b..4e25703535c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3291,7 +3291,11 @@ else if ($id > 0 || ! empty($ref)) foreach($extrafields->attribute_label as $key=>$label) { + if ($action == 'edit_extras') { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + } else { + $value=$object->array_options["options_".$key]; + } if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e7276a46845..c45e52bec39 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3203,6 +3203,7 @@ class Facture extends CommonInvoice $sql.= ' WHERE l.fk_facture = '.$this->id; $sql.= ' ORDER BY l.rang ASC, l.rowid'; + dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e283c977f5f..dcbd404a3e0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -187,7 +187,7 @@ abstract class CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; $sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ; - $sql.= $this->db->idate($datecreate); + $sql.= "'".$this->db->idate($datecreate)."'"; $sql.= ", 4, '". $id_type_contact . "' "; $sql.= ")"; dol_syslog(get_class($this)."::add_contact sql=".$sql); @@ -2517,6 +2517,9 @@ abstract class CommonObject if ($objecttype == 'cabinetmed_cons') { $classpath = 'cabinetmed/class'; $module='cabinetmed'; $subelement='cabinetmedcons'; } + if ($objecttype == 'fichinter') { + $classpath = 'fichinter/class'; $module='ficheinter'; $subelement='fichinter'; + } //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6c6a9de1e99..8c5f485de32 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -445,7 +445,7 @@ class ExtraFields if(is_array($param) && count($param) > 0) { - $param = serialize($param); + $param = $this->db->escape(serialize($param)); } $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 451b85f81e8..3a5b02a9d48 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -49,8 +49,8 @@ else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();} else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();} else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();} - else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();} - else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();} + else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();} + else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();} else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();} else size.val('').attr('disabled','disabled'); } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 03dbc54f697..a2a1d3a79f9 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -381,7 +381,7 @@ class PaiementFourn extends Paiement $sql.= ' WHERE pf.fk_facturefourn = f.rowid AND fk_paiementfourn = '.$this->id; if ($filter) $sql.= ' AND '.$filter; - dol_syslog(get_class($this).'::getBillsArray sql='.$sql); + dol_syslog(get_class($this).'::getBillsArray sql='.$sql,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) {