Merge pull request #5463 from hregis/develop_origin

New: Add entity field in llx_societe_remise_except and llx_societe_remise
This commit is contained in:
Laurent Destailleur
2016-08-28 12:23:04 +02:00
committed by GitHub
11 changed files with 307 additions and 82 deletions

View File

@@ -1118,7 +1118,8 @@ class Form
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql.= " re.description, re.fk_facture_source";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
$sql.= " WHERE fk_soc = ".(int) $socid;
$sql.= " WHERE re.fk_soc = ".(int) $socid;
$sql.= " AND re.entity = " . $conf->entity;
if ($filter) $sql.= " AND ".$filter;
$sql.= " ORDER BY re.description ASC";
@@ -5166,9 +5167,9 @@ class Form
print '<br>';
print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '');
print '<table class="noborder allwidth">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Ref").'</td>';
@@ -5178,9 +5179,9 @@ class Form
print '<td align="right">'.$langs->trans("Status").'</td>';
print '<td></td>';
print '</tr>';
$numoutput=0;
foreach($object->linkedObjects as $objecttype => $objects)
{
$tplpath = $element = $subelement = $objecttype;
@@ -5240,7 +5241,7 @@ class Form
foreach($dirtpls as $reldir)
{
$res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
if ($res)
if ($res)
{
$numoutput++;
break;
@@ -5252,7 +5253,7 @@ class Form
{
print '<tr><td class="opacitymedium" colspan="7">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
return $num;
@@ -5261,7 +5262,7 @@ class Form
/**
* Show block with links to link to other objects.
*
*
* @param CommonObject $object Object we want to show links to
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction.
* @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion.
@@ -5286,12 +5287,12 @@ class Form
'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id)
);
foreach($possiblelinks as $key => $possiblelink)
{
$num = 0;
if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto)))
{
print '<div id="'.$key.'list"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
@@ -5301,7 +5302,7 @@ class Form
{
$num = $this->db->num_rows($resqllist);
$i = 0;
print '<br><form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addlink">';
@@ -5317,7 +5318,7 @@ class Form
while ($i < $num)
{
$objp = $this->db->fetch_object($resqlorderlist);
$var = ! $var;
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">';
@@ -5332,7 +5333,7 @@ class Form
}
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
print '</form>';
$this->db->free($resqllist);
} else {
@@ -5341,8 +5342,8 @@ class Form
print '</div>';
if ($num > 0)
{
}
}
//$linktoelem.=($linktoelem?' &nbsp; ':'');
if ($num > 0) $linktoelem.='<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">' . $langs->trans($possiblelink['label']) .' ('.$num.')</a></li>';
//else $linktoelem.=$langs->trans($possiblelink['label']);
@@ -5360,7 +5361,7 @@ class Form
</div>
</dd>
</dl>';
print '<!-- Add js to show linkto box -->
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
@@ -5372,7 +5373,7 @@ class Form
});
</script>
';
return $linktoelem;
}
@@ -5667,7 +5668,7 @@ class Form
{
if ($file && file_exists($dir."/".$file))
{
if ($addlinktofullsize)
if ($addlinktofullsize)
{
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
if ($urladvanced) $ret.='<a href="'.$urladvanced.'">';
@@ -5678,7 +5679,7 @@ class Form
}
else if ($altfile && file_exists($dir."/".$altfile))
{
if ($addlinktofullsize)
if ($addlinktofullsize)
{
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile);
if ($urladvanced) $ret.='<a href="'.$urladvanced.'">';