From 0cdee454cf3b02219b384286615fbba1296793b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Aug 2005 16:20:27 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20La=20mise=20a=20jour=20du=20code=20fourn?= =?UTF-8?q?isseur=20etait=20sauv=E9=20dans=20le=20code=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/soc.php | 507 +++++++++++++++++++++++++------------------------ 1 file changed, 258 insertions(+), 249 deletions(-) diff --git a/htdocs/soc.php b/htdocs/soc.php index 2e86bd7372f..f229e88c2c3 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -150,282 +150,294 @@ $form = new Form($db); if ($_GET["action"] == 'create' || $_POST["action"] == 'create') { - if ($user->rights->societe->creer) + if ($user->rights->societe->creer) { - /* - * Fiche societe en mode création (Creation en 1 ou 2 temps selon COMPANY_CREATE_TWO_STEPS) - */ - $soc->fournisseur=0; - if ($_GET["type"]=='f') { $soc->fournisseur=1; } - if ($_GET["type"]=='c') { $soc->client=1; } - if ($_GET["type"]=='p') { $soc->client=2; } - if ($_POST["nom"]) { $soc->nom=$_POST["nom"]; } - - print_titre($langs->trans("NewCompany")); - print "
\n"; - - if ($soc->error) - { - print '
'; - print nl2br($soc->error); - print '
'; - } - - include("./soc.js.php"); - - print '\n"; - - print '
'; - - print ''; - print ''; - - print ''; - - print ''; - print ''; - - // 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) - { - $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); - } - $soc->pays_code=$obj->code; - $soc->pays=$obj->libelle; - } - - if ($step==1 && defined("COMPANY_CREATE_TWO_STEPS")) - { - print ''; - - print ''; - print ''; - print ''."\n"; - - } - if ($step==2 || ! defined("COMPANY_CREATE_TWO_STEPS")) { - - print ''; - print ''; - - if (defined("COMPANY_CREATE_TWO_STEPS")) - { - print ''; - } - else - { - print ''; - } - - print ''; - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''."\n"; - - print ''."\n"; - - print ''."\n"; - - } - - print '
'.$langs->trans('Name').''.$langs->trans('Prefix').'
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id); - print '
'.$langs->trans('CustomerCode').'
'.$langs->trans('SupplierCode').'
'.$langs->trans('Country').''; - print $soc->pays; - print ''; - print '
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id); - print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').'filltownfromzip) print ' onblur="PopupPostalCode(cp.value,ville)"'; - print '>'; - if ($conf->filltownfromzip) print ' '; - print ''.$langs->trans('Town').'
'.$langs->trans('State').''; - $form->select_departement($soc->departement_id,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); - print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Web').'
'.$langs->transcountry('ProfId1',$soc->pays_code).''.$langs->transcountry('ProfId2',$soc->pays_code).'
'.$langs->transcountry('ProfId3',$soc->pays_code).' 
'.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('JuridicalStatus').''; - $form->select_forme_juridique($soc->forme_juridique_code,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); - print '
'.$langs->trans("Type").''; - $form->select_array("typent_id",$soc->typent_array(), $soc->typent_id); - print ''.$langs->trans("Staff").''; - $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); - print '
'.$langs->trans('VATIntraShort').''; - - print ''; - print ''; - print ' '.$langs->trans("VATIntraCheckableOnEUSite"); - print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('Supplier').''."\n"; - $form->selectyesnonum("fournisseur",$soc->fournisseur); - print '
'; - if (defined("COMPANY_CREATE_TWO_STEPS")) - { - print '     '; - } - print '
'."\n"; - print '
'."\n"; - + /* + * Fiche societe en mode création (Creation en 1 ou 2 temps selon COMPANY_CREATE_TWO_STEPS) + */ + $soc->fournisseur=0; + if ($_GET["type"]=='f') { $soc->fournisseur=1; } + if ($_GET["type"]=='c') { $soc->client=1; } + if ($_GET["type"]=='p') { $soc->client=2; } + if ($_POST["nom"]) { $soc->nom=$_POST["nom"]; } + + print_titre($langs->trans("NewCompany")); + print "
\n"; + + if ($soc->error) + { + print '
'; + print nl2br($soc->error); + print '
'; + } + + include("./soc.js.php"); + + print '\n"; + + print '
'; + + print ''; + print ''; + + print ''; + + print ''; + print ''; + + // 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) + { + $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); + } + $soc->pays_code=$obj->code; + $soc->pays=$obj->libelle; + } + + if ($step==1 && defined("COMPANY_CREATE_TWO_STEPS")) + { + print ''; + + print ''; + print ''; + print ''."\n"; + + } + if ($step==2 || ! defined("COMPANY_CREATE_TWO_STEPS")) { + + // Client / Prospect + print ''; + print ''; + + // Fournisseur + print ''; + print ''; + print ''; + + + if (defined("COMPANY_CREATE_TWO_STEPS")) + { + print ''; + } + else + { + print ''; + } + + print ''; + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''."\n"; + + } + + print '
'.$langs->trans('Name').''.$langs->trans('Prefix').'
'.$langs->trans('Country').''; + $form->select_pays($soc->pays_id); + print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; + print ''; + print '
'.$langs->trans('Supplier').''; + $form->selectyesnonum("fournisseur",$soc->fournisseur); + print ''.$langs->trans('SupplierCode').''; + print ''; + print '
'.$langs->trans('Country').''; + print $soc->pays; + print ''; + print '
'.$langs->trans('Country').''; + $form->select_pays($soc->pays_id); + print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').'filltownfromzip) print ' onblur="PopupPostalCode(cp.value,ville)"'; + print '>'; + if ($conf->filltownfromzip) print ' '; + print ''.$langs->trans('Town').'
'.$langs->trans('State').''; + $form->select_departement($soc->departement_id,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); + print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Web').'
'.$langs->transcountry('ProfId1',$soc->pays_code).''.$langs->transcountry('ProfId2',$soc->pays_code).'
'.$langs->transcountry('ProfId3',$soc->pays_code).' 
'.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('JuridicalStatus').''; + $form->select_forme_juridique($soc->forme_juridique_code,(defined("COMPANY_CREATE_TWO_STEPS")?$soc->pays_code:0)); + print '
'.$langs->trans("Type").''; + $form->select_array("typent_id",$soc->typent_array(), $soc->typent_id); + print ''.$langs->trans("Staff").''; + $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); + print '
'.$langs->trans('VATIntraShort').''; + + print ''; + print ''; + print ' '.$langs->trans("VATIntraCheckableOnEUSite"); + print '
'; + if (defined("COMPANY_CREATE_TWO_STEPS")) + { + print '     '; + } + print '
'."\n"; + print '
'."\n"; + } } elseif ($_GET["action"] == 'edit') { - /* - * Fiche societe en mode edition - */ - - print_titre($langs->trans("EditCompany")); + /* + * Fiche societe en mode edition + */ - if ($_GET["socid"]) + print_titre($langs->trans("EditCompany")); + + if ($_GET["socid"]) { - if ($no_reload <> 1) - { - $soc = new Societe($db); - $soc->id = $_GET["socid"]; - $soc->fetch($_GET["socid"]); - } + if ($no_reload <> 1) + { + $soc = new Societe($db); + $soc->id = $_GET["socid"]; + $soc->fetch($_GET["socid"]); + } - if ($soc->error) - { - print '
'; - print $soc->error; - print '
'; - } + if ($soc->error) + { + print '
'; + print $soc->error; + print '
'; + } - print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print '
'; - print ''; + print ''; print ''; - print ''; + // Client / Prospect + print ''; + print ''; - print ''; - - print ''; - - print ''; - print ''; + // Fournisseur + print ''; + print ''; + print ''; - print ''; + print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; - print ''; - - print ''; - print ''; - print ''; + print ''; - print ''; + print ''; + print ''; - print ''; + print ''; - print ''; + print ''; + print ''; + print ''; - print ''; - print ''; + print ''; - print ''; + print ''; - print ''; - - print ''; + print ''; - print '
'.$langs->trans('Name').'
'.$langs->trans('Name').'
'.$langs->trans("Prefix").''; print ''; print '
'.$langs->trans('CustomerCode').''; - if ($soc->codeclient_modifiable == 1) - { - print ''; - } - else - { - print $soc->code_client; - } - print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; + if ($soc->codeclient_modifiable == 1) + { + print ''; + } + else + { + print $soc->code_client; + } + print '
'.$langs->trans('SupplierCode').''; - if ($soc->codefournisseur_modifiable == 1) - { - print ''; - } - else - { - print $soc->code_fournisseur; - } - print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Supplier').''; + $form->selectyesnonum("fournisseur",$soc->fournisseur); + print ''.$langs->trans('SupplierCode').''; + if ($soc->codefournisseur_modifiable == 1) + { + print ''; + } + else + { + print $soc->code_fournisseur; + } + print '
'.$langs->trans('State').''; - $form->select_departement($soc->departement_id,0); - print '
'.$langs->trans('Address').'
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id); - print '
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('State').''; + $form->select_departement($soc->departement_id,0); + print '
'.$langs->trans('Web').'
'.$langs->transcountry('ProfId1',$soc->pays_code).''.$langs->transcountry('ProfId2',$soc->pays_code).'
'.$langs->transcountry('ProfId3',$soc->pays_code).' 
'.$langs->trans('Country').''; + $form->select_pays($soc->pays_id); + print '
'.$langs->trans('VATIntraShort').''; - print ''; - print ''; - print ' '.$langs->trans("VATIntraCheckableOnEUSite"); - print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('Web').'
'.$langs->trans('JuridicalStatus').''; - $form->select_forme_juridique($soc->forme_juridique_code,0); - print '
'.$langs->transcountry('ProfId1',$soc->pays_code).''.$langs->transcountry('ProfId2',$soc->pays_code).'
'.$langs->transcountry('ProfId3',$soc->pays_code).' 
'.$langs->trans("Type").''; - $form->select_array("typent_id",$soc->typent_array(), $soc->typent_id); - print ''.$langs->trans("Staff").''; - $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); - print '
'.$langs->trans('VATIntraShort').''; + print ''; + print ''; + print ' '.$langs->trans("VATIntraCheckableOnEUSite"); + print '
'.$langs->trans('ProspectCustomer').'
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('Supplier').''; - $form->selectyesnonum("fournisseur",$soc->fournisseur); - print '
'.$langs->trans('JuridicalStatus').''; + $form->select_forme_juridique($soc->forme_juridique_code,0); + print '
'; - 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 ''; + + print ''; + print ''; } } else { + /* + * Fiche société en mode visu + */ + if ($no_reload <> 1) { $soc = new Societe($db); @@ -481,9 +493,6 @@ else dolibarr_fiche_head($head, 0, $soc->nom); - /* - * Fiche société en mode visu - */ // Confirmation de la suppression de la facture if ($_GET["action"] == 'delete') @@ -525,8 +534,8 @@ else print "".$langs->trans('Address')."".nl2br($soc->adresse).""; - print ''.$langs->trans('Zip').''.$soc->cp.""; - print ''.$langs->trans('Town').''.$soc->ville.""; + print ''.$langs->trans('Zip').''.$soc->cp.""; + print ''.$langs->trans('Town').''.$soc->ville.""; print ''.$langs->trans('Country').''.$soc->pays.'';