diff --git a/htdocs/soc.php b/htdocs/soc.php index b8bbc49724f..b78ccb9a1b6 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -172,18 +172,14 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') print ''; } - $js_OpenPopupWindow = "function PopupPostalCode(postalcode,objectville) -{ - var url = 'searchpostalcode.php?cp=' + postalcode + '&targetobject=window.opener.document.formsoc.' + objectville.name; - // alert(url); - var hWnd = window.open(url, \"SearchPostalCodeWindow\", \"width=\" + 300 + \",height=\" + 150 + \",resizable=yes,scrollbars=yes\"); - if((document.window != null) && (!hWnd.opener)) - hWnd.opener = document.window; -} -"; + include("./soc.js.php"); + + print '\n"; - print "\n"; print '
'; + print ''; print ''; @@ -194,114 +190,121 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') // On positionne pays_id, pays_code et libelle du pays choisi $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:(defined(MAIN_INFO_SOCIETE_PAYS)?MAIN_INFO_SOCIETE_PAYS:''); - if ($soc->pays_id) { + if ($soc->pays_id) + { $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$soc->pays_id; $resql=$db->query($sql); if ($resql) - { - $obj = $db->fetch_object($resql); - } - else { - dolibarr_print_error($db); - } + { + $obj = $db->fetch_object($resql); + } + else + { + dolibarr_print_error($db); + } $soc->pays_code=$obj->code; $soc->pays=$obj->libelle; - } - - if ($step==1 && defined("COMPANY_CREATE_TWO_STEPS")) { - print ''.$langs->trans('Country').''; - $form->select_pays($soc->pays_id); - print ''; - - print ''; - print ''; + } + + if ($step==1 && defined("COMPANY_CREATE_TWO_STEPS")) + { + print ''.$langs->trans('Country').''; + $form->select_pays($soc->pays_id); + print ''; + + print ''; + print ''; print ''."\n"; - - } + + } if ($step==2 || ! defined("COMPANY_CREATE_TWO_STEPS")) { print ''.$langs->trans('CustomerCode').''; print ''.$langs->trans('SupplierCode').''; - - if (defined("COMPANY_CREATE_TWO_STEPS")) { - print ''.$langs->trans('Country').''; - print $soc->pays; - print ''; - print ''; - } else { - print ''.$langs->trans('Country').''; - $form->select_pays($soc->pays_id); - print ''; - } - - print ''; - print ''; + + if (defined("COMPANY_CREATE_TWO_STEPS")) + { + print ''.$langs->trans('Country').''; + print $soc->pays; + print ''; + print ''; + } + else + { + print ''.$langs->trans('Country').''; + $form->select_pays($soc->pays_id); + print ''; + } + + print ''; + print ''; - print ''.$langs->trans('Address').''; - - print ''.$langs->trans('Zip').'filltownfromzip) print ' onblur="PopupPostalCode(cp.value,ville)"'; - print '>'; - if ($conf->filltownfromzip) print ' '; - print ''; - print ''.$langs->trans('Town').''; - - print ''.$langs->trans('State').''; - $form->select_departement($soc->departement_id,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); - print ''; - - print ''.$langs->trans('Phone').''; - print ''.$langs->trans('Fax').''; - - print ''.$langs->trans('Web').''; - - print ''.$langs->transcountry('ProfId1',$soc->pays_code).''; - print ''.$langs->transcountry('ProfId2',$soc->pays_code).''; - print ''.$langs->transcountry('ProfId3',$soc->pays_code).' '; - - print ''.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).''; + print ''.$langs->trans('Address').''; + + print ''.$langs->trans('Zip').'filltownfromzip) print ' onblur="PopupPostalCode(cp.value,ville)"'; + print '>'; + if ($conf->filltownfromzip) print ' '; + print ''; + print ''.$langs->trans('Town').''; + + print ''.$langs->trans('State').''; + $form->select_departement($soc->departement_id,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); + print ''; + + print ''.$langs->trans('Phone').''; + print ''.$langs->trans('Fax').''; + + print ''.$langs->trans('Web').''; + + print ''.$langs->transcountry('ProfId1',$soc->pays_code).''; + print ''.$langs->transcountry('ProfId2',$soc->pays_code).''; + print ''.$langs->transcountry('ProfId3',$soc->pays_code).' '; + + print ''.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).''; + + print ''.$langs->trans('JuridicalStatus').''; + $form->select_forme_juridique($soc->forme_juridique_code,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); + print ''; + + print ''.$langs->trans("Type").''; + $form->select_array("typent_id",$soc->typent_array(), $soc->typent_id); + print ''; + print ''.$langs->trans("Staff").''; + $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); + print ''; + + print ''.$langs->trans('TVAIntra').''; + + print ''; + print ''; + print ' '.$langs->trans("VATIntraCheckableOnEUSite"); + print ''; + + print ''.$langs->trans('ProspectCustomer').''."\n"; + + print ''.$langs->trans('Supplier').''."\n"; + $form->selectyesnonum("fournisseur",$soc->fournisseur); + print ''."\n"; + + print ''; + if (defined("COMPANY_CREATE_TWO_STEPS")) + { + print '     '; + } + print ''."\n"; + + } - print ''.$langs->trans('JuridicalStatus').''; - $form->select_forme_juridique($soc->forme_juridique_code,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); - print ''; - - print ''.$langs->trans("Type").''; - $form->select_array("typent_id",$soc->typent_array(), $soc->typent_id); - print ''; - print ''.$langs->trans("Staff").''; - $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); - print ''; - - print ''.$langs->trans('TVAIntra').''; - - print ''; - print ''; - print ' '.$langs->trans("VATIntraCheckableOnEUSite"); - print ''; - - print ''.$langs->trans('ProspectCustomer').''."\n"; - - print ''.$langs->trans('Supplier').''."\n"; - $form->selectyesnonum("fournisseur",$soc->fournisseur); - print ''."\n"; - - print ''; - if (defined("COMPANY_CREATE_TWO_STEPS")) { - print '     '; - } - print ''."\n"; - - } - print ''."\n"; print '
'."\n"; - + } } elseif ($_GET["action"] == 'edit')