From 71107f8dcab6f3e3786309567412e9783b97d186 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sun, 19 May 2013 18:28:27 +0200 Subject: [PATCH 1/3] Triggger ficheinter line --- htdocs/fichinter/class/fichinter.class.php | 109 +++++++++++++++++---- htdocs/fichinter/fiche.php | 11 ++- 2 files changed, 96 insertions(+), 24 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 5fcb865897c..c54575efde8 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -93,7 +93,9 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::create ref=".$this->ref); // Check parameters - if (! is_numeric($this->duree)) { $this->duree = 0; } + if (! is_numeric($this->duree)) { + $this->duree = 0; + } if ($this->socid <= 0) { $this->error='ErrorBadParameterForFunc'; @@ -218,8 +220,12 @@ class Fichinter extends CommonObject */ function update($user, $notrigger=0) { - if (! is_numeric($this->duree)) { $this->duree = 0; } - if (! dol_strlen($this->fk_project)) { $this->fk_project = 0; } + if (! is_numeric($this->duree)) { + $this->duree = 0; + } + if (! dol_strlen($this->fk_project)) { + $this->fk_project = 0; + } $this->db->begin(); @@ -240,7 +246,7 @@ class Fichinter extends CommonObject // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf); + $result=$interface->run_triggers('FICHINTER_UPDATE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } @@ -411,7 +417,9 @@ class Fichinter extends CommonObject include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('FICHINTER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } // Fin appel triggers if (! $error) @@ -525,7 +533,7 @@ class Fichinter extends CommonObject * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only * @return string String with URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto=0,$option='') { global $langs; @@ -651,9 +659,9 @@ class Fichinter extends CommonObject * @param User $user Object user who delete * @return int <0 if KO, >0 if OK */ - function delete($user) + function delete($user, $notrigger=0) { - global $conf; + global $conf,$langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; @@ -718,15 +726,17 @@ class Fichinter extends CommonObject } } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } + if (! $notrigger) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } // Fin appel triggers - + } $this->db->commit(); return 1; } @@ -814,13 +824,14 @@ class Fichinter extends CommonObject /** * Adding a line of intervention into data base * + * @param user $user User that do the action * @param int $fichinterid Id of intervention * @param string $desc Line description * @param date $date_intervention Intervention date * @param int $duration Intervention duration * @return int >0 if ok, <0 if ko */ - function addline($fichinterid, $desc, $date_intervention, $duration) + function addline($user,$fichinterid, $desc, $date_intervention, $duration) { dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration"); @@ -836,7 +847,7 @@ class Fichinter extends CommonObject $line->datei = $date_intervention; $line->duration = $duration; - $result=$line->insert(); + $result=$line->insert($user); if ($result > 0) { $this->db->commit(); @@ -1003,10 +1014,14 @@ class FichinterLigne /** * Insert the line into database * + * @param User $user Objet user that make creation + * @param int $notrigger Disable all triggers * @return int <0 if ko, >0 if ok */ - function insert() + function insert($user, $notrigger=0) { + global $langs,$conf; + dol_syslog("FichinterLigne::insert rang=".$this->rang); $this->db->begin(); @@ -1049,6 +1064,21 @@ class FichinterLigne if ($result > 0) { $this->rang=$rangToUse; + + if (! $notrigger) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $resulttrigger=$interface->run_triggers('FICHINTERDET_CREATE',$this,$user,$langs,$conf); + if ($resulttrigger < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } + } + + if (!$error) { $this->db->commit(); return $result; } @@ -1071,10 +1101,14 @@ class FichinterLigne /** * Update intervention into database * + * @param User $user Objet user that make creation + * @param int $notrigger Disable all triggers * @return int <0 if ko, >0 if ok */ - function update() + function update($user,$notrigger=0) { + global $langs,$conf; + $this->db->begin(); // Mise a jour ligne en base @@ -1092,6 +1126,22 @@ class FichinterLigne $result=$this->update_total(); if ($result > 0) { + + if (! $notrigger) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $resulttrigger=$interface->run_triggers('FICHINTERDET_UPDATE',$this,$user,$langs,$conf); + if ($resulttrigger < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } + } + + if (!$error) + { $this->db->commit(); return $result; } @@ -1167,10 +1217,14 @@ class FichinterLigne /** * Delete a intervention line * + * @param User $user Objet user that make creation + * @param int $notrigger Disable all triggers * @return int >0 if ok, <0 if ko */ - function deleteline() + function deleteline($user,$notrigger=0) { + global $langs,$conf; + if ($this->statut == 0) { dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid); @@ -1186,6 +1240,19 @@ class FichinterLigne if ($result > 0) { $this->db->commit(); + + if (! $notrigger) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $resulttrigger=$interface->run_triggers('FICHINTERDET_DELETE',$this,$user,$langs,$conf); + if ($resulttrigger < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } + return $result; } else diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index eeb3c9ee89c..bf781349549 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -248,6 +248,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $duration = 3600; $result = $object->addline( + $user, $id, $desc, $date_intervention, @@ -376,7 +377,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fich { $object->fetch($id); $object->fetch_thirdparty(); - $object->delete($user); + $result=$object->delete($user); + if ($result<0) { + setEventMessage($object->error,'errors'); + } header('Location: '.DOL_URL_ROOT.'/fichinter/list.php?leftmenu=ficheinter'); exit; @@ -426,6 +430,7 @@ else if ($action == "addline" && $user->rights->ficheinter->creer) $duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int')); $result=$object->addline( + $user, $id, $desc, $date_intervention, @@ -501,7 +506,7 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST( $objectline->datei = $date_inter; $objectline->desc = $desc; $objectline->duration = $duration; - $result = $objectline->update(); + $result = $objectline->update($user); if ($result < 0) { dol_print_error($db); @@ -535,7 +540,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> dol_print_error($db); exit; } - $result=$objectline->deleteline(); + $result=$objectline->deleteline($user); if ($object->fetch($objectline->fk_fichinter) <= 0) { From cb182752cc54f85452de19f82bd9b5684bd45d22 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sun, 19 May 2013 18:47:14 +0200 Subject: [PATCH 2/3] 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) { From 1470b75e5c25b3b357a71988be90a11d767efc0f Mon Sep 17 00:00:00 2001 From: simnandez Date: Mon, 20 May 2013 18:43:21 +0200 Subject: [PATCH 3/3] Trad: Fix Catalan words into Spanish --- htdocs/langs/es_ES/admin.lang | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 18f58bd0dae..883c316bdce 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -356,14 +356,14 @@ ExtrafieldPhone=Teléfono ExtrafieldPrice=Precio ExtrafieldMail=Correo ExtrafieldSelect=Lista de selección -ExtrafieldSelectList=Llista de selección de table +ExtrafieldSelectList=Lista de selección de tabla ExtrafieldSeparator=Separador ExtrafieldCheckBox=Casilla de verificación ExtrafieldRadio=Botón de selección excluyente -ExtrafieldParamHelpselect=La llista ha de ser en forma clau, valor

per exemple :
1,text1
2,text2
3,text3
... -ExtrafieldParamHelpcheckbox=La llista ha de ser en forma clau, valor

per exemple :
1,text1
2,text2
3,text3
... -ExtrafieldParamHelpradio=La llista ha de ser en forma clau, valor

per exemple :
1,text1
2,text2
3,text3
... -ExtrafieldParamHelpsellist=La llista ha de ser del table

per exemple :
table:label:(code)
+ExtrafieldParamHelpselect=La lista ha de ser en forma llave, valor

por ejemplo :
1,text1
2,text2
3,text3
... +ExtrafieldParamHelpcheckbox=La lista ha de ser en forma llave, valor

por ejemplo :
1,text1
2,text2
3,text3
... +ExtrafieldParamHelpradio=La lista ha de ser en forma llave, valor

por ejemplo :
1,text1
2,text2
3,text3
... +ExtrafieldParamHelpsellist=La lista ha de ser de la tabl

por ejemplo:
table:label:(code)
LibraryToBuildPDF=Librería usada para la creación de archivos PDF WarningUsingFPDF=Atención: Su archivo conf.php contiene la directiva dolibarr_pdf_force_fpdf=1. Esto hace que se use la librería FPDF para generar sus archivos PDF. Esta librería es antigua y no cubre algunas funcionalidades (Unicode, transparencia de imágenes, idiomas cirílicos, árabes o asiáticos, etc.), por lo que puede tener problemas en la generación de los PDF.
Para resolverlo, y disponer de un soporte completo de PDF, puede descargar la librería TCPDF , y a continuación comentar o eliminar la línea $dolibarr_pdf_force_fpdf=1, y añadir en su lugar $dolibarr_lib_TCPDF_PATH='ruta_a_TCPDF' LocalTaxDesc=Algunos países aplican 2 o 3 tasas a cada línea de factura. Si es el caso, escoja el tipo de la segunda y tercera tasa y su valor. Los posibles tipos son:
1 : tasa local aplicable a productos y servicios sin IVA (IVA no se aplica en la tasa local)
2 : tasa local se aplica a productos y servicios antes del IVA (IVA se calcula sobre importe+tasa local)
3 : tasa local se aplica a productos sin IVA (IVA no se aplica en la tasa local)
4 : tasa local se aplica a productos antes del IVA (IVA se calcula sobre el importe+tasa local)
5 : tasa local se aplica a servicios sin IVA (IVA no se aplica a la tasa local)
6 : tasa local se aplica a servicios antes del IVA (IVA se calcula sobre importe + tasa local)