Reduce memory print of object thirdparty.
This commit is contained in:
parent
8e2999f73f
commit
3ea52a7967
@ -598,24 +598,6 @@ class Societe extends CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update localtax value of third party
|
|
||||||
* @param int $id id societe
|
|
||||||
* @param int $local Localtax to update
|
|
||||||
* @param double $value value of localtax
|
|
||||||
*/
|
|
||||||
function update_localtax($id, $local, $value)
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
|
||||||
if($local==1) $sql .= "localtax1_value = '" .$value."'";
|
|
||||||
else $sql.="localtax2_value='".$value."'";
|
|
||||||
$sql.="WHERE rowid=".$id;
|
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update parameters of third party
|
* Update parameters of third party
|
||||||
*
|
*
|
||||||
@ -673,7 +655,7 @@ class Societe extends CommonObject
|
|||||||
// Local taxes
|
// Local taxes
|
||||||
$this->localtax1_assuj=trim($this->localtax1_assuj);
|
$this->localtax1_assuj=trim($this->localtax1_assuj);
|
||||||
$this->localtax2_assuj=trim($this->localtax2_assuj);
|
$this->localtax2_assuj=trim($this->localtax2_assuj);
|
||||||
|
|
||||||
$this->localtax1_value=trim($this->localtax1_value);
|
$this->localtax1_value=trim($this->localtax1_value);
|
||||||
$this->localtax2_value=trim($this->localtax2_value);
|
$this->localtax2_value=trim($this->localtax2_value);
|
||||||
|
|
||||||
@ -782,10 +764,10 @@ class Societe extends CommonObject
|
|||||||
$sql .=",localtax1_value =".$this->localtax1_value;
|
$sql .=",localtax1_value =".$this->localtax1_value;
|
||||||
}
|
}
|
||||||
else $sql .=",localtax1_value =0.000";
|
else $sql .=",localtax1_value =0.000";
|
||||||
|
|
||||||
}
|
}
|
||||||
else $sql .=",localtax1_value =0.000";
|
else $sql .=",localtax1_value =0.000";
|
||||||
|
|
||||||
if($this->localtax2_assuj==1)
|
if($this->localtax2_assuj==1)
|
||||||
{
|
{
|
||||||
if($this->localtax2_value!='')
|
if($this->localtax2_value!='')
|
||||||
@ -793,7 +775,7 @@ class Societe extends CommonObject
|
|||||||
$sql .=",localtax2_value =".$this->localtax2_value;
|
$sql .=",localtax2_value =".$this->localtax2_value;
|
||||||
}
|
}
|
||||||
else $sql .=",localtax2_value =0.000";
|
else $sql .=",localtax2_value =0.000";
|
||||||
|
|
||||||
}
|
}
|
||||||
else $sql .=",localtax2_value =0.000";
|
else $sql .=",localtax2_value =0.000";
|
||||||
|
|
||||||
@ -1074,7 +1056,7 @@ class Societe extends CommonObject
|
|||||||
// Local Taxes
|
// Local Taxes
|
||||||
$this->localtax1_assuj = $obj->localtax1_assuj;
|
$this->localtax1_assuj = $obj->localtax1_assuj;
|
||||||
$this->localtax2_assuj = $obj->localtax2_assuj;
|
$this->localtax2_assuj = $obj->localtax2_assuj;
|
||||||
|
|
||||||
$this->localtax1_value = $obj->localtax1_value;
|
$this->localtax1_value = $obj->localtax1_value;
|
||||||
$this->localtax2_value = $obj->localtax2_value;
|
$this->localtax2_value = $obj->localtax2_value;
|
||||||
|
|
||||||
|
|||||||
@ -101,22 +101,22 @@ if (empty($reshook))
|
|||||||
// We defined value code_fournisseur
|
// We defined value code_fournisseur
|
||||||
$_POST["code_fournisseur"]="Acompleter";
|
$_POST["code_fournisseur"]="Acompleter";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action=='set_localtax1')
|
if($action=='set_localtax1')
|
||||||
{
|
{
|
||||||
//obtidre selected del combobox
|
//obtidre selected del combobox
|
||||||
$value=GETPOST('lt1');
|
$value=GETPOST('lt1');
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$res=$object->update_localtax($socid, 1, $value);
|
$object->fetch($socid);
|
||||||
|
$res=$object->setValueFrom('localtax1_value', $value);
|
||||||
}
|
}
|
||||||
if($action=='set_localtax2')
|
if($action=='set_localtax2')
|
||||||
{
|
{
|
||||||
//obtidre selected del combobox
|
//obtidre selected del combobox
|
||||||
$value=GETPOST('lt2');
|
$value=GETPOST('lt2');
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$res=$object->update_localtax($socid, 2, $value);
|
$object->fetch($socid);
|
||||||
|
$res=$object->setValueFrom('localtax2_value', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new third party
|
// Add new third party
|
||||||
@ -175,7 +175,7 @@ if (empty($reshook))
|
|||||||
// Local Taxes
|
// Local Taxes
|
||||||
$object->localtax1_assuj = GETPOST('localtax1assuj_value');
|
$object->localtax1_assuj = GETPOST('localtax1assuj_value');
|
||||||
$object->localtax2_assuj = GETPOST('localtax2assuj_value');
|
$object->localtax2_assuj = GETPOST('localtax2assuj_value');
|
||||||
|
|
||||||
$object->localtax1_value = GETPOST('lt1');
|
$object->localtax1_value = GETPOST('lt1');
|
||||||
$object->localtax2_value = GETPOST('lt2');
|
$object->localtax2_value = GETPOST('lt2');
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ else
|
|||||||
//Local Taxes
|
//Local Taxes
|
||||||
$object->localtax1_assuj = GETPOST('localtax1assuj_value');
|
$object->localtax1_assuj = GETPOST('localtax1assuj_value');
|
||||||
$object->localtax2_assuj = GETPOST('localtax2assuj_value');
|
$object->localtax2_assuj = GETPOST('localtax2assuj_value');
|
||||||
|
|
||||||
$object->localtax1_value =GETPOST('lt1');
|
$object->localtax1_value =GETPOST('lt1');
|
||||||
$object->localtax2_value =GETPOST('lt2');
|
$object->localtax2_value =GETPOST('lt2');
|
||||||
|
|
||||||
@ -1174,7 +1174,7 @@ else
|
|||||||
//Local Taxes
|
//Local Taxes
|
||||||
$object->localtax1_assuj = GETPOST('localtax1assuj_value');
|
$object->localtax1_assuj = GETPOST('localtax1assuj_value');
|
||||||
$object->localtax2_assuj = GETPOST('localtax2assuj_value');
|
$object->localtax2_assuj = GETPOST('localtax2assuj_value');
|
||||||
|
|
||||||
$object->localtax1_value =GETPOST('lt1');
|
$object->localtax1_value =GETPOST('lt1');
|
||||||
$object->localtax2_value =GETPOST('lt2');
|
$object->localtax2_value =GETPOST('lt2');
|
||||||
|
|
||||||
@ -1195,8 +1195,8 @@ else
|
|||||||
if($object->localtax2_assuj==0){
|
if($object->localtax2_assuj==0){
|
||||||
$sub2=0;
|
$sub2=0;
|
||||||
}else{$sub2=1;}
|
}else{$sub2=1;}
|
||||||
|
|
||||||
|
|
||||||
print "\n".'<script type="text/javascript">';
|
print "\n".'<script type="text/javascript">';
|
||||||
print '$(document).ready(function () {
|
print '$(document).ready(function () {
|
||||||
var val='.$sub.';
|
var val='.$sub.';
|
||||||
@ -1231,11 +1231,11 @@ else
|
|||||||
$(".cblt2").hide();
|
$(".cblt2").hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});';
|
});';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
|
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
@ -1465,11 +1465,11 @@ else
|
|||||||
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
|
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
|
||||||
print '</span>';
|
print '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
|
print '</td><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
|
||||||
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
|
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
|
||||||
if (! isOnlyOneLocalTax(2))
|
if (! isOnlyOneLocalTax(2))
|
||||||
{
|
{
|
||||||
print '<span class="cblt2"> '.$langs->transcountry("Type",$mysoc->country_code).': ';
|
print '<span class="cblt2"> '.$langs->transcountry("Type",$mysoc->country_code).': ';
|
||||||
$formcompany->select_localtax(2,$object->localtax2_value, "lt2");
|
$formcompany->select_localtax(2,$object->localtax2_value, "lt2");
|
||||||
print '</span>';
|
print '</span>';
|
||||||
@ -1860,7 +1860,7 @@ else
|
|||||||
print '<td>'.$object->localtax1_value.'</td>';
|
print '<td>'.$object->localtax1_value.'</td>';
|
||||||
}
|
}
|
||||||
print '</tr></form>';
|
print '</tr></form>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
|
elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
|
||||||
@ -1870,7 +1870,7 @@ else
|
|||||||
print '</td><tr>';
|
print '</td><tr>';
|
||||||
if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2)))
|
if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2)))
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
|
||||||
print '<input type="hidden" name="action" value="set_localtax2">';
|
print '<input type="hidden" name="action" value="set_localtax2">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -1883,7 +1883,7 @@ else
|
|||||||
print '<td>'.$object->localtax2_value.'</td>';
|
print '<td>'.$object->localtax2_value.'</td>';
|
||||||
}
|
}
|
||||||
print '</tr></form>';
|
print '</tr></form>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -2053,7 +2053,7 @@ else
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans($titreform));
|
print_titre($langs->trans($titreform));
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user