diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b9c962a5168..06846d34203 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -140,7 +140,7 @@ if (empty($reshook)) if (!$errors) { // TODO Move the merge function into class of object. - + $db->begin(); // Recopy some data @@ -157,26 +157,29 @@ if (empty($reshook)) { 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', @@ -487,7 +490,7 @@ if (empty($reshook)) if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); - + if ($result >= 0) { if ($object->particulier) @@ -557,7 +560,7 @@ if (empty($reshook)) $object->code_fournisseur = null; $object->code_client = null; } - + $error=$object->error; $errors=$object->errors; } @@ -852,7 +855,7 @@ else $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; @@ -860,7 +863,7 @@ else else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); } - + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); @@ -1136,7 +1139,7 @@ else print ''; print ''.fieldLabel('Web','url').''; print ''; - + // Skype if (! empty($conf->skype->enabled)) { @@ -1216,7 +1219,7 @@ else print ''.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0),1); print ''; - + } elseif($mysoc->localtax1_assuj=="1") { @@ -1230,7 +1233,7 @@ else print $form->selectyesno('localtax2assuj_value',(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0),1); print ''; } - + // Type - Size print ''.fieldLabel('ThirdPartyType','typent_id').''."\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. @@ -1751,7 +1754,7 @@ else $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); print ''; } - + print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if (! isOnlyOneLocalTax(2)) @@ -1761,7 +1764,7 @@ else print ''; } print ''; - + } elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") { @@ -1774,7 +1777,7 @@ else print ''; } print ''; - + } elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") { @@ -1788,7 +1791,7 @@ else } print ''; } - + // VAT Code print ''.fieldLabel('VATIntra','intra_vat').''; print ''; @@ -2090,7 +2093,7 @@ else print ''.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; print yn($object->localtax2_assuj); print ''; - + if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) { print '
'; @@ -2144,7 +2147,7 @@ else print ''.$object->localtax1_value.''; } print '
'; - + } } elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") @@ -2154,7 +2157,7 @@ else print ''; if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) { - + print '
'; print ''; print ''; @@ -2167,7 +2170,7 @@ else print ''.$object->localtax2_value.''; } print '
'; - + } } /* @@ -2178,7 +2181,7 @@ else print ''; } */ - + // VAT Code print ''; print ''.$langs->trans('VATIntra').''; @@ -2573,10 +2576,10 @@ else // 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)) {