Skip to content

Commit

Permalink
Merge branch 'patch-11' of github.com:defrance69/dolibarr into
Browse files Browse the repository at this point in the history
defrance69-patch-11

Conflicts:
	htdocs/core/class/commonobject.class.php
  • Loading branch information
eldy committed Jun 26, 2014
2 parents d5e0bcf + 8acd702 commit 29dfb71
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
29 changes: 17 additions & 12 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -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) ";
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 '<table class="nobordernopadding" width="100%">';
if (! empty($conf->global->MARGININFO_HIDE_SHOW))
{
print "<img onclick=\"$('.margininfos').toggle();\" src='".img_picto($langs->trans("Hide")."/".$langs->trans("Show"),'object_margin.png','','',1)."'>";
if ($conf->global->MARGININFO_HIDE_SHOW == 2) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>'; // hide by default
}

print '<table class="nobordernopadding margintable" width="100%">';
print '<tr class="liste_titre">';
print '<td width="30%">'.$langs->trans('Margins').'</td>';
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -3392,21 +3397,21 @@ 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
*/
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);
Expand All @@ -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;

}

}
2 changes: 1 addition & 1 deletion htdocs/core/tpl/objectline_view.tpl.php
Expand Up @@ -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);
?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<td align="right" class="nowrap"><?php $coldisplay++; ?><div class="margininfos"><?php echo price($line->pa_ht); ?></div></td>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
<?php
Expand Down

0 comments on commit 29dfb71

Please sign in to comment.