Skip to content

Commit

Permalink
FIX #7156
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 23, 2017
1 parent 947acff commit 1b1d1a8
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions htdocs/societe/soc.php
Expand Up @@ -140,7 +140,7 @@
if (!$errors)
{
// TODO Move the merge function into class of object.

$db->begin();

// Recopy some data
Expand All @@ -157,26 +157,29 @@
{
if (empty($object->$property)) $object->$property = $soc_origin->$property;
}

// Concat some data
$listofproperties=array(
'note_public', 'note_private'
'note_public', 'note_private'
);
foreach ($listofproperties as $property)
{
$object->$property = dol_concatdesc($object->$property, $soc_origin->$property);
}

// Merge extrafields
foreach ($soc_origin->array_options as $key => $val)
if (is_array($soc_origin->array_options))
{
if (empty($object->array_options[$key])) $object->array_options[$key] = $val;
foreach ($soc_origin->array_options as $key => $val)
{
if (empty($object->array_options[$key])) $object->array_options[$key] = $val;
}
}

// TODO Merge categories
$object->update($object->id, $user);
// Move links

// Move links
$objects = array(
'Adherent' => '/adherents/class/adherent.class.php',
'Societe' => '/societe/class/societe.class.php',
Expand Down Expand Up @@ -487,7 +490,7 @@
if (empty($object->fournisseur)) $object->code_fournisseur='';

$result = $object->create($user);

if ($result >= 0)
{
if ($object->particulier)
Expand Down Expand Up @@ -557,7 +560,7 @@
$object->code_fournisseur = null;
$object->code_client = null;
}

$error=$object->error; $errors=$object->errors;
}

Expand Down Expand Up @@ -852,15 +855,15 @@
$object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm');
$object->client = GETPOST('client')?GETPOST('client'):$object->client;

if(empty($duplicate_code_error)) {
$object->code_client = GETPOST('code_client', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur;
}
else {
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings');
}

$object->code_fournisseur = GETPOST('code_fournisseur', 'alpha');
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
Expand Down Expand Up @@ -1136,7 +1139,7 @@
print '<td colspan="3"><input type="text" name="email" id="email" value="'.$object->email.'"></td></tr>';
print '<tr><td>'.fieldLabel('Web','url').'</td>';
print '<td colspan="3"><input type="text" name="url" id="url" value="'.$object->url.'"></td></tr>';

// Skype
if (! empty($conf->skype->enabled))
{
Expand Down Expand Up @@ -1216,7 +1219,7 @@
print '</td><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
print $form->selectyesno('localtax2assuj_value',(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0),1);
print '</td></tr>';

}
elseif($mysoc->localtax1_assuj=="1")
{
Expand All @@ -1230,7 +1233,7 @@
print $form->selectyesno('localtax2assuj_value',(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0),1);
print '</td></tr>';
}

// Type - Size
print '<tr><td>'.fieldLabel('ThirdPartyType','typent_id').'</td><td class="maxwidthonsmartphone">'."\n";
$sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
Expand Down Expand Up @@ -1751,7 +1754,7 @@
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
print '</span>';
}

print '</td><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>';
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
if (! isOnlyOneLocalTax(2))
Expand All @@ -1761,7 +1764,7 @@
print '</span>';
}
print '</td></tr>';

}
elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1")
{
Expand All @@ -1774,7 +1777,7 @@
print '</span>';
}
print '</td></tr>';

}
elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
{
Expand All @@ -1788,7 +1791,7 @@
}
print '</td></tr>';
}

// VAT Code
print '<tr><td>'.fieldLabel('VATIntra','intra_vat').'</td>';
print '<td colspan="3">';
Expand Down Expand Up @@ -2090,7 +2093,7 @@
print '</td></tr><tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
print yn($object->localtax2_assuj);
print '</td></tr>';

if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1)))
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
Expand Down Expand Up @@ -2144,7 +2147,7 @@
print '<td>'.$object->localtax1_value.'</td>';
}
print '</tr></form>';

}
}
elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
Expand All @@ -2154,7 +2157,7 @@
print '</td></tr>';
if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2)))
{

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="token" value="'.$_SESSION['newtoken'].'">';
Expand All @@ -2167,7 +2170,7 @@
print '<td>'.$object->localtax2_value.'</td>';
}
print '</tr></form>';

}
}
/*
Expand All @@ -2178,7 +2181,7 @@
print '</td><tr>';
}
*/

// VAT Code
print '<tr>';
print '<td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
Expand Down Expand Up @@ -2573,10 +2576,10 @@

// Subsidiaries list
if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES))
{
{
$result=show_subsidiaries($conf,$langs,$db,$object);
}

// Contacts list
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
Expand Down

0 comments on commit 1b1d1a8

Please sign in to comment.