diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0c1d18e28edfb..4ab213431146e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -205,7 +205,7 @@ function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger $datecreate = dol_now(); $this->db->begin(); - + // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; @@ -223,7 +223,7 @@ function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger $result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user); if ($result < 0) { $this->db->rollback(); return -1; } } - + $this->db->commit(); return 1; } @@ -310,7 +310,7 @@ function delete_contact($rowid, $notrigger=0) $this->db->begin(); - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql.= " WHERE rowid =".$rowid; @@ -3226,12 +3226,17 @@ function displayMarginInfos($force_price=false) if (! $user->rights->margins->liretous) return; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); $marginInfo = $this->getMarginInfos($force_price); - print ''; + if (! empty($conf->global->MARGININFO_HIDE_SHOW)) + { + print ""; + if ($conf->global->MARGININFO_HIDE_SHOW == 2) print ''; // hide by default + } + print '
'; print ''; print ''; print ''; @@ -3350,7 +3355,7 @@ function delete_resource($rowid, $element, $notrigger=0) $this->db->begin(); - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; $sql.= " WHERE rowid =".$rowid; @@ -3392,13 +3397,13 @@ function __clone() } } } - + /** * Call trigger based on this instance - * + * * NB: Error from trigger are stacked in errors * NB2: if trigger fail, action should be canceled. - * + * * @param string $trigger_name trigger's name to execute * @param User $user Object user * @return int Result of run_triggers @@ -3406,7 +3411,7 @@ function __clone() function call_trigger($trigger_name, $user) { global $langs,$conf; - + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf); @@ -3415,13 +3420,13 @@ function call_trigger($trigger_name, $user) { $this->errors=array_merge($this->errors,$interface->errors); } - else + else { $this->errors=$interface->errors; } } return $result; - + } } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 948a61bae2c3f..ce87aa5e81596 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -123,7 +123,7 @@ if (! empty($conf->margin->enabled) && empty($user->societe_id)) { $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?> - + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?>
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').'pa_ht); ?>
pa_ht); ?>
pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>