From 249a8a909147dca04bdb631630aff2fa0072f7c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2011 14:12:44 +0000 Subject: [PATCH] Uniformize code (use $object) --- htdocs/societe/soc.php | 776 +++++++++++++++++++++-------------------- 1 file changed, 389 insertions(+), 387 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 30d8e28621f..9f48158be68 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -26,7 +26,7 @@ * \file htdocs/societe/soc.php * \ingroup societe * \brief Third party card page - * \version $Id: soc.php,v 1.117 2011/07/02 13:09:53 eldy Exp $ + * \version $Id: soc.php,v 1.118 2011/07/02 14:12:44 eldy Exp $ */ require("../main.inc.php"); @@ -52,7 +52,6 @@ $error=0; $errors=array(); $action = GETPOST('action'); $confirm = GETPOST('confirm'); -$soc = new Societe($db); $object = new Societe($db); $extrafields = new ExtraFields($db); @@ -61,8 +60,8 @@ $socid = GETPOST("socid"); if ($user->societe_id) $socid=$user->societe_id; // Get object canvas (By default, this is not defined, so standard usage of dolibarr) -if (!empty($socid)) $soc->getCanvas($socid); -$canvas = (!empty($soc->canvas)?$soc->canvas:GETPOST("canvas")); +if (!empty($socid)) $object->getCanvas($socid); +$canvas = (!empty($object->canvas)?$object->canvas:GETPOST("canvas")); if (! empty($canvas)) { require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); @@ -109,7 +108,11 @@ if (! empty($object->hooks)) if ($action=='add') $action='create'; if ($action=='update') $action='edit'; } - else $reshook+=$resaction; + else + { + if ($action=='add') + $reshook+=$resaction; + } } } } @@ -154,101 +157,101 @@ if (empty($reshook)) if ($action == 'update') { - $soc->fetch($socid); + $object->fetch($socid); } - else if ($canvas) $soc->canvas=$canvas; + else if ($canvas) $object->canvas=$canvas; - if ($_REQUEST["private"] == 1) + if (GETPOST("private") == 1) { - $soc->particulier = $_REQUEST["private"]; + $object->particulier = GETPOST("private"); - $soc->name = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]); - $soc->nom = $soc->name; // TODO obsolete - $soc->nom_particulier = $_POST["nom"]; - $soc->prenom = $_POST["prenom"]; - $soc->civilite_id = $_POST["civilite_id"]; + $object->name = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]); + $object->nom = $object->name; // TODO obsolete + $object->nom_particulier = $_POST["nom"]; + $object->prenom = $_POST["prenom"]; + $object->civilite_id = $_POST["civilite_id"]; } else { - $soc->name = $_POST["nom"]; - $soc->nom = $soc->name; // TODO obsolete + $object->name = $_POST["nom"]; + $object->nom = $object->name; // TODO obsolete } - $soc->address = $_POST["adresse"]; - $soc->adresse = $_POST["adresse"]; // TODO obsolete - $soc->zip = $_POST["zipcode"]; - $soc->cp = $_POST["zipcode"]; // TODO obsolete - $soc->town = $_POST["town"]; - $soc->ville = $_POST["town"]; // TODO obsolete - $soc->pays_id = $_POST["pays_id"]; - $soc->departement_id = $_POST["departement_id"]; - $soc->tel = $_POST["tel"]; - $soc->fax = $_POST["fax"]; - $soc->email = trim($_POST["email"]); - $soc->url = trim($_POST["url"]); - $soc->siren = $_POST["idprof1"]; - $soc->siret = $_POST["idprof2"]; - $soc->ape = $_POST["idprof3"]; - $soc->idprof4 = $_POST["idprof4"]; - $soc->prefix_comm = $_POST["prefix_comm"]; - $soc->code_client = $_POST["code_client"]; - $soc->code_fournisseur = $_POST["code_fournisseur"]; - $soc->capital = $_POST["capital"]; - $soc->gencod = $_POST["gencod"]; + $object->address = $_POST["adresse"]; + $object->adresse = $_POST["adresse"]; // TODO obsolete + $object->zip = $_POST["zipcode"]; + $object->cp = $_POST["zipcode"]; // TODO obsolete + $object->town = $_POST["town"]; + $object->ville = $_POST["town"]; // TODO obsolete + $object->pays_id = $_POST["pays_id"]; + $object->departement_id = $_POST["departement_id"]; + $object->tel = $_POST["tel"]; + $object->fax = $_POST["fax"]; + $object->email = trim($_POST["email"]); + $object->url = trim($_POST["url"]); + $object->siren = $_POST["idprof1"]; + $object->siret = $_POST["idprof2"]; + $object->ape = $_POST["idprof3"]; + $object->idprof4 = $_POST["idprof4"]; + $object->prefix_comm = $_POST["prefix_comm"]; + $object->code_client = $_POST["code_client"]; + $object->code_fournisseur = $_POST["code_fournisseur"]; + $object->capital = $_POST["capital"]; + $object->gencod = $_POST["gencod"]; - $soc->tva_intra = $_POST["tva_intra"]; - $soc->tva_assuj = $_POST["assujtva_value"]; - $soc->status = $_POST["status"]; + $object->tva_intra = $_POST["tva_intra"]; + $object->tva_assuj = $_POST["assujtva_value"]; + $object->status = $_POST["status"]; // Local Taxes - $soc->localtax1_assuj = $_POST["localtax1assuj_value"]; - $soc->localtax2_assuj = $_POST["localtax2assuj_value"]; + $object->localtax1_assuj = $_POST["localtax1assuj_value"]; + $object->localtax2_assuj = $_POST["localtax2assuj_value"]; - $soc->forme_juridique_code = $_POST["forme_juridique_code"]; - $soc->effectif_id = $_POST["effectif_id"]; - if ($_REQUEST["private"] == 1) + $object->forme_juridique_code = $_POST["forme_juridique_code"]; + $object->effectif_id = $_POST["effectif_id"]; + if (GETPOST("private") == 1) { - $soc->typent_id = 8; // TODO predict another method if the field "special" change of rowid + $object->typent_id = 8; // TODO predict another method if the field "special" change of rowid } else { - $soc->typent_id = $_POST["typent_id"]; + $object->typent_id = $_POST["typent_id"]; } - $soc->client = $_POST["client"]; - $soc->fournisseur = $_POST["fournisseur"]; - $soc->fournisseur_categorie = $_POST["fournisseur_categorie"]; + $object->client = $_POST["client"]; + $object->fournisseur = $_POST["fournisseur"]; + $object->fournisseur_categorie = $_POST["fournisseur_categorie"]; - $soc->commercial_id = $_POST["commercial_id"]; - $soc->default_lang = $_POST["default_lang"]; + $object->commercial_id = $_POST["commercial_id"]; + $object->default_lang = $_POST["default_lang"]; // Get extra fields foreach($_POST as $key => $value) { if (preg_match("/^options_/",$key)) { - $soc->array_options[$key]=$_POST[$key]; + $object->array_options[$key]=$_POST[$key]; } } - if (GETPOST('deletephoto')) $soc->logo = ''; - else if (! empty($_FILES['photo']['name'])) $soc->logo = dol_sanitizeFileName($_FILES['photo']['name']); + if (GETPOST('deletephoto')) $object->logo = ''; + else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); // Check parameters if (empty($_POST["cancel"])) { - if (! empty($soc->email) && ! isValidEMail($soc->email)) + if (! empty($object->email) && ! isValidEMail($object->email)) { $langs->load("errors"); - $error++; $errors[] = $langs->trans("ErrorBadEMail",$soc->email); + $error++; $errors[] = $langs->trans("ErrorBadEMail",$object->email); $action = ($action=='add'?'create':'edit'); } - if (! empty($soc->url) && ! isValidUrl($soc->url)) + if (! empty($object->url) && ! isValidUrl($object->url)) { $langs->load("errors"); - $error++; $errors[] = $langs->trans("ErrorBadUrl",$soc->url); + $error++; $errors[] = $langs->trans("ErrorBadUrl",$object->url); $action = ($action=='add'?'create':'edit'); } - if ($soc->fournisseur && ! $conf->fournisseur->enabled) + if ($object->fournisseur && ! $conf->fournisseur->enabled) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled"); @@ -262,29 +265,29 @@ if (empty($reshook)) { $db->begin(); - if (empty($soc->client)) $soc->code_client=''; - if (empty($soc->fournisseur)) $soc->code_fournisseur=''; + if (empty($object->client)) $object->code_client=''; + if (empty($object->fournisseur)) $object->code_fournisseur=''; - $result = $soc->create($user); + $result = $object->create($user); if ($result >= 0) { - if ($soc->particulier) + if ($object->particulier) { dol_syslog("This thirdparty is a personal people",LOG_DEBUG); $contact=new Contact($db); - $contact->civilite_id = $soc->civilite_id; - $contact->name=$soc->nom_particulier; - $contact->firstname=$soc->prenom; - $contact->address=$soc->address; - $contact->zip=$soc->zip; - $contact->cp=$soc->cp; - $contact->town=$soc->town; - $contact->ville=$soc->ville; - $contact->fk_pays=$soc->fk_pays; - $contact->socid=$soc->id; // fk_soc + $contact->civilite_id = $object->civilite_id; + $contact->name=$object->nom_particulier; + $contact->firstname=$object->prenom; + $contact->address=$object->address; + $contact->zip=$object->zip; + $contact->cp=$object->cp; + $contact->town=$object->town; + $contact->ville=$object->ville; + $contact->fk_pays=$object->fk_pays; + $contact->socid=$object->id; // fk_soc $contact->status=1; - $contact->email=$soc->email; + $contact->email=$object->email; $contact->priv=0; $result=$contact->create($user); @@ -295,7 +298,7 @@ if (empty($reshook)) } ### Gestion du logo de la société - $dir = $conf->societe->dir_output."/".$soc->id."/logos/"; + $dir = $conf->societe->dir_output."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { @@ -329,16 +332,16 @@ if (empty($reshook)) } else { - $error=$soc->error; $errors=$soc->errors; + $error=$object->error; $errors=$object->errors; } if ($result >= 0) { $db->commit(); - $url=$_SERVER["PHP_SELF"]."?socid=".$soc->id; - if (($soc->client == 1 || $soc->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/fiche.php?socid=".$soc->id; - else if ($soc->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/fiche.php?socid=".$soc->id; + $url=$_SERVER["PHP_SELF"]."?socid=".$object->id; + if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/fiche.php?socid=".$object->id; + else if ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/fiche.php?socid=".$object->id; Header("Location: ".$url); exit; } @@ -357,28 +360,28 @@ if (empty($reshook)) exit; } - $soc->oldcopy=dol_clone($soc); + $object->oldcopy=dol_clone($object); // To not set code if third party is not concerned. But if it had values, we keep them. - if (empty($soc->client) && empty($soc->oldcopy->code_client)) $soc->code_client=''; - if (empty($soc->fournisseur)&& empty($soc->oldcopy->code_fournisseur)) $soc->code_fournisseur=''; + if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client=''; + if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur=''; //var_dump($soc);exit; - $result = $soc->update($socid,$user,1,$soc->oldcopy->codeclient_modifiable(),$soc->oldcopy->codefournisseur_modifiable()); + $result = $object->update($socid,$user,1,$object->oldcopy->codeclient_modifiable(),$object->oldcopy->codefournisseur_modifiable()); if ($result <= 0) { - $error = $soc->error; $errors = $soc->errors; + $error = $object->error; $errors = $object->errors; } ### Gestion du logo de la société - $dir = $conf->societe->dir_output."/".$soc->id."/logos"; + $dir = $conf->societe->dir_output."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (GETPOST('deletephoto')) { - $fileimg=$conf->societe->dir_output.'/'.$soc->id.'/logos/'.$soc->logo; - $dirthumbs=$conf->societe->dir_output.'/'.$soc->id.'/logos/thumbs'; + $fileimg=$conf->societe->dir_output.'/'.$object->id.'/logos/'.$object->logo; + $dirthumbs=$conf->societe->dir_output.'/'.$object->id.'/logos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } @@ -423,7 +426,7 @@ if (empty($reshook)) } else { - $soc->id = $socid; + $object->id = $socid; $action= "edit"; } } @@ -433,18 +436,18 @@ if (empty($reshook)) // Delete third party if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { - $soc->fetch($socid); - $result = $soc->delete($socid); + $object->fetch($socid); + $result = $object->delete($socid); if ($result >= 0) { - Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$soc->nom.""); + Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$object->nom.""); exit; } else { $langs->load("errors"); - $error=$langs->trans($soc->error); $errors = $soc->errors; + $error=$langs->trans($object->error); $errors = $object->errors; $action=''; } } @@ -463,9 +466,8 @@ if (empty($reshook)) { require_once(DOL_DOCUMENT_ROOT.'/includes/modules/societe/modules_societe.class.php'); - $soc = new Societe($db); - $soc->fetch($socid); - $soc->fetch_thirdparty(); + $object->fetch($socid); + $object->fetch_thirdparty(); // Define output language $outputlangs = $langs; @@ -477,7 +479,7 @@ if (empty($reshook)) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=thirdparty_doc_create($db, $soc->id, '', $_REQUEST['model'], $outputlangs); + $result=thirdparty_doc_create($db, $object->id, '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -485,7 +487,7 @@ if (empty($reshook)) } else { - Header ('Location: '.$_SERVER["PHP_SELF"].'?socid='.$soc->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); + Header ('Location: '.$_SERVER["PHP_SELF"].'?socid='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); exit; } } @@ -577,55 +579,55 @@ else require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php"); $modCodeFournisseur = new $module; - //if ($_GET["type"]=='cp') { $soc->client=3; } - if (GETPOST("type")!='f') $soc->client=3; - if (GETPOST("type")=='c') { $soc->client=1; } - if (GETPOST("type")=='p') { $soc->client=2; } - if ($conf->fournisseur->enabled && (GETPOST("type")=='f' || GETPOST("type")=='')) { $soc->fournisseur=1; } - if (GETPOST("private")==1) { $soc->particulier=1; } + //if ($_GET["type"]=='cp') { $object->client=3; } + if (GETPOST("type")!='f') $object->client=3; + if (GETPOST("type")=='c') { $object->client=1; } + if (GETPOST("type")=='p') { $object->client=2; } + if ($conf->fournisseur->enabled && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; } + if (GETPOST("private")==1) { $object->particulier=1; } - $soc->nom=$_POST["nom"]; - $soc->prenom=$_POST["prenom"]; - $soc->particulier=$_REQUEST["private"]; - $soc->prefix_comm=$_POST["prefix_comm"]; - $soc->client=$_POST["client"]?$_POST["client"]:$soc->client; - $soc->code_client=$_POST["code_client"]; - $soc->fournisseur=$_POST["fournisseur"]?$_POST["fournisseur"]:$soc->fournisseur; - $soc->code_fournisseur=$_POST["code_fournisseur"]; - $soc->adresse=$_POST["adresse"]; // TODO obsolete - $soc->address=$_POST["adresse"]; - $soc->cp=$_POST["zipcode"]; - $soc->ville=$_POST["town"]; - $soc->departement_id=$_POST["departement_id"]; - $soc->tel=$_POST["tel"]; - $soc->fax=$_POST["fax"]; - $soc->email=$_POST["email"]; - $soc->url=$_POST["url"]; - $soc->capital=$_POST["capital"]; - $soc->gencod=$_POST["gencod"]; - $soc->siren=$_POST["idprof1"]; - $soc->siret=$_POST["idprof2"]; - $soc->ape=$_POST["idprof3"]; - $soc->idprof4=$_POST["idprof4"]; - $soc->typent_id=$_POST["typent_id"]; - $soc->effectif_id=$_POST["effectif_id"]; + $object->nom=$_POST["nom"]; + $object->prenom=$_POST["prenom"]; + $object->particulier=$_REQUEST["private"]; + $object->prefix_comm=$_POST["prefix_comm"]; + $object->client=$_POST["client"]?$_POST["client"]:$object->client; + $object->code_client=$_POST["code_client"]; + $object->fournisseur=$_POST["fournisseur"]?$_POST["fournisseur"]:$object->fournisseur; + $object->code_fournisseur=$_POST["code_fournisseur"]; + $object->adresse=$_POST["adresse"]; // TODO obsolete + $object->address=$_POST["adresse"]; + $object->cp=$_POST["zipcode"]; + $object->ville=$_POST["town"]; + $object->departement_id=$_POST["departement_id"]; + $object->tel=$_POST["tel"]; + $object->fax=$_POST["fax"]; + $object->email=$_POST["email"]; + $object->url=$_POST["url"]; + $object->capital=$_POST["capital"]; + $object->gencod=$_POST["gencod"]; + $object->siren=$_POST["idprof1"]; + $object->siret=$_POST["idprof2"]; + $object->ape=$_POST["idprof3"]; + $object->idprof4=$_POST["idprof4"]; + $object->typent_id=$_POST["typent_id"]; + $object->effectif_id=$_POST["effectif_id"]; - $soc->tva_assuj = $_POST["assujtva_value"]; - $soc->status= $_POST["status"]; + $object->tva_assuj = $_POST["assujtva_value"]; + $object->status= $_POST["status"]; //Local Taxes - $soc->localtax1_assuj = $_POST["localtax1assuj_value"]; - $soc->localtax2_assuj = $_POST["localtax2assuj_value"]; + $object->localtax1_assuj = $_POST["localtax1assuj_value"]; + $object->localtax2_assuj = $_POST["localtax2assuj_value"]; - $soc->tva_intra=$_POST["tva_intra"]; + $object->tva_intra=$_POST["tva_intra"]; - $soc->commercial_id=$_POST["commercial_id"]; - $soc->default_lang=$_POST["default_lang"]; + $object->commercial_id=$_POST["commercial_id"]; + $object->default_lang=$_POST["default_lang"]; - $soc->logo = dol_sanitizeFileName($_FILES['photo']['name']); + $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); ### Gestion du logo de la société - $dir = $conf->societe->dir_output."/".$soc->id."/logos"; + $dir = $conf->societe->dir_output."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { @@ -658,12 +660,12 @@ else ### Gestion du logo de la société // We set pays_id, pays_code and label for the selected country - $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; - if ($soc->pays_id) + $object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; + if ($object->pays_id) { $sql = "SELECT code, libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_pays"; - $sql.= " WHERE rowid = ".$soc->pays_id; + $sql.= " WHERE rowid = ".$object->pays_id; $resql=$db->query($sql); if ($resql) { @@ -673,10 +675,10 @@ else { dol_print_error($db); } - $soc->pays_code=$obj->code; - $soc->pays=$obj->libelle; + $object->pays_code=$obj->code; + $object->pays=$obj->libelle; } - $soc->forme_juridique_code=$_POST['forme_juridique_code']; + $object->forme_juridique_code=$_POST['forme_juridique_code']; /* Show create form */ @@ -732,35 +734,35 @@ else print ''; print ''; - print ''; + print ''; print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; print ''; // Name, firstname - if ($soc->particulier) + if ($object->particulier) { - print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; + print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } print ''; } else { - print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; + print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } print ''; } // If javascript on, we show option individual if ($conf->use_javascript_ajax) { - print ''; + print ''; print ''; print ''; @@ -769,19 +771,19 @@ else // Prospect/Customer print ''; print ''; print ''; print ''; // Category - if ($soc->fournisseur) + if ($object->fournisseur) { - $load = $soc->LoadSupplierCateg(); + $load = $object->LoadSupplierCateg(); if ( $load == 0) { - if (sizeof($soc->SupplierCategories) > 0) + if (sizeof($object->SupplierCategories) > 0) { print ''; print ''; } } @@ -831,25 +833,25 @@ else if ($conf->global->MAIN_MODULE_BARCODE) { print ''; } // Address print ''; // Zip / Town print ''; // Country print ''; @@ -857,54 +859,54 @@ else if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''; } // Phone / Fax - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; print ''; // IdProf1 (SIREN for France) - $idprof=$langs->transcountry('ProfId1',$soc->pays_code); + $idprof=$langs->transcountry('ProfId1',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; // IdProf2 (SIRET for France) - $idprof=$langs->transcountry('ProfId2',$soc->pays_code); + $idprof=$langs->transcountry('ProfId2',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; print ''; print ''; // IdProf3 (APE for France) - $idprof=$langs->transcountry('ProfId3',$soc->pays_code); + $idprof=$langs->transcountry('ProfId3',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; // IdProf4 (NU for France) - $idprof=$langs->transcountry('ProfId4',$soc->pays_code); + $idprof=$langs->transcountry('ProfId4',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; @@ -918,7 +920,7 @@ else print ''; print ''; print ''; print ''; // Legal Form print ''; print ''; // Capital - print ''; + print ''; // Local Taxes // TODO add specific function by country @@ -1001,7 +1003,7 @@ else if ($conf->global->MAIN_MULTILANGS) { print ''; print ''; } @@ -1012,7 +1014,7 @@ else print ''; print ''; print ''; } @@ -1049,10 +1051,10 @@ else if ($socid) { - $soc = new Societe($db); - $res=$soc->fetch($socid); - if ($res < 0) { dol_print_error($db,$soc->error); exit; } - $res=$soc->fetch_optionals($socid,$extralabels); + $object = new Societe($db); + $res=$object->fetch($socid); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($socid,$extralabels); if ($res < 0) { dol_print_error($db); exit; } // Load object modCodeTiers @@ -1086,45 +1088,45 @@ else if (! empty($_POST["nom"])) { // We overwrite with values if posted - $soc->nom=$_POST["nom"]; - $soc->prefix_comm=$_POST["prefix_comm"]; - $soc->client=$_POST["client"]; - $soc->code_client=$_POST["code_client"]; - $soc->fournisseur=$_POST["fournisseur"]; - $soc->code_fournisseur=$_POST["code_fournisseur"]; - $soc->adresse=$_POST["adresse"]; // TODO obsolete - $soc->address=$_POST["adresse"]; - $soc->cp=$_POST["zipcode"]; - $soc->ville=$_POST["town"]; - $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; - $soc->departement_id=$_POST["departement_id"]; - $soc->tel=$_POST["tel"]; - $soc->fax=$_POST["fax"]; - $soc->email=$_POST["email"]; - $soc->url=$_POST["url"]; - $soc->capital=$_POST["capital"]; - $soc->siren=$_POST["idprof1"]; - $soc->siret=$_POST["idprof2"]; - $soc->ape=$_POST["idprof3"]; - $soc->idprof4=$_POST["idprof4"]; - $soc->typent_id=$_POST["typent_id"]; - $soc->effectif_id=$_POST["effectif_id"]; - $soc->gencod=$_POST["gencod"]; - $soc->forme_juridique_code=$_POST["forme_juridique_code"]; - $soc->default_lang=$_POST["default_lang"]; + $object->nom=$_POST["nom"]; + $object->prefix_comm=$_POST["prefix_comm"]; + $object->client=$_POST["client"]; + $object->code_client=$_POST["code_client"]; + $object->fournisseur=$_POST["fournisseur"]; + $object->code_fournisseur=$_POST["code_fournisseur"]; + $object->adresse=$_POST["adresse"]; // TODO obsolete + $object->address=$_POST["adresse"]; + $object->cp=$_POST["zipcode"]; + $object->ville=$_POST["town"]; + $object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; + $object->departement_id=$_POST["departement_id"]; + $object->tel=$_POST["tel"]; + $object->fax=$_POST["fax"]; + $object->email=$_POST["email"]; + $object->url=$_POST["url"]; + $object->capital=$_POST["capital"]; + $object->siren=$_POST["idprof1"]; + $object->siret=$_POST["idprof2"]; + $object->ape=$_POST["idprof3"]; + $object->idprof4=$_POST["idprof4"]; + $object->typent_id=$_POST["typent_id"]; + $object->effectif_id=$_POST["effectif_id"]; + $object->gencod=$_POST["gencod"]; + $object->forme_juridique_code=$_POST["forme_juridique_code"]; + $object->default_lang=$_POST["default_lang"]; - $soc->tva_assuj = $_POST["assujtva_value"]; - $soc->tva_intra=$_POST["tva_intra"]; - $soc->status=$_POST["status"]; + $object->tva_assuj = $_POST["assujtva_value"]; + $object->tva_intra=$_POST["tva_intra"]; + $object->status=$_POST["status"]; //Local Taxes - $soc->localtax1_assuj = $_POST["localtax1assuj_value"]; - $soc->localtax2_assuj = $_POST["localtax2assuj_value"]; + $object->localtax1_assuj = $_POST["localtax1assuj_value"]; + $object->localtax2_assuj = $_POST["localtax2assuj_value"]; // We set pays_id, and pays_code label of the chosen country - if ($soc->pays_id) + if ($object->pays_id) { - $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$soc->pays_id; + $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$object->pays_id; $resql=$db->query($sql); if ($resql) { @@ -1134,8 +1136,8 @@ else { dol_print_error($db); } - $soc->pays_code=$obj->code; - $soc->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; + $object->pays_code=$obj->code; + $object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; } } @@ -1153,61 +1155,61 @@ else print ''."\n"; } - print ''; + print ''; print ''; print ''; - print ''; + print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; print '
'.$langs->trans('LastName').'
'.$langs->trans('LastName').''.$langs->trans('Prefix').''.$langs->trans('Prefix').'
'.$langs->trans('ThirdPartyName').'
'.$langs->trans('ThirdPartyName').''.$langs->trans('Prefix').''.$langs->trans('Prefix').'
'.$langs->trans('FirstName').'
'.$langs->trans('FirstName').' 
'.$langs->trans("UserTitle").''; print $formcompany->select_civilite($contact->civilite_id).'
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; print '
'; - $tmpcode=$soc->code_client; - if ($modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($soc,0); + $tmpcode=$object->code_client; + if ($modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($object,0); print ''; print ''; - $s=$modCodeClient->getToolTip($langs,$soc,0); + $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); print '
'; @@ -792,30 +794,30 @@ else // Supplier print '
'.$langs->trans('Supplier').''; - print $form->selectyesno("fournisseur",$soc->fournisseur,1); + print $form->selectyesno("fournisseur",$object->fournisseur,1); print ''.$langs->trans('SupplierCode').''; print '
'; - $tmpcode=$soc->code_fournisseur; - if ($modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($soc,1); + $tmpcode=$object->code_fournisseur; + if ($modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($object,1); print ''; print ''; - $s=$modCodeFournisseur->getToolTip($langs,$soc,1); + $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); print '
'; print '
'.$langs->trans('SupplierCategory').''; - print $form->selectarray("fournisseur_categorie",$soc->SupplierCategories,$_POST["fournisseur_categorie"],1); + print $form->selectarray("fournisseur_categorie",$object->SupplierCategories,$_POST["fournisseur_categorie"],1); print '
'.$langs->trans('Gencod').''; - print $soc->gencod; + print $object->gencod; print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($soc->cp,'zipcode',array('town','selectpays_id','departement_id'),6); + print $formcompany->select_ziptown($object->cp,'zipcode',array('town','selectpays_id','departement_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($soc->ville,'town',array('zipcode','selectpays_id','departement_id')); + print $formcompany->select_ziptown($object->ville,'town',array('zipcode','selectpays_id','departement_id')); print '
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id,'pays_id'); + $form->select_pays($object->pays_id,'pays_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; - if ($soc->pays_id) $formcompany->select_departement($soc->departement_id,$soc->pays_code); + if ($object->pays_id) $formcompany->select_departement($object->departement_id,$object->pays_code); else print $countrynotdefined; print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$idprof.''; - print $formcompany->get_input_id_prof(1,'idprof1',$soc->siren,$soc->pays_code); + print $formcompany->get_input_id_prof(1,'idprof1',$object->siren,$object->pays_code); print '  '.$idprof.''; - print $formcompany->get_input_id_prof(2,'idprof2',$soc->siret,$soc->pays_code); + print $formcompany->get_input_id_prof(2,'idprof2',$object->siret,$object->pays_code); print '  
'.$idprof.''; - print $formcompany->get_input_id_prof(3,'idprof3',$soc->ape,$soc->pays_code); + print $formcompany->get_input_id_prof(3,'idprof3',$object->ape,$object->pays_code); print '  '.$idprof.''; - print $formcompany->get_input_id_prof(4,'idprof4',$soc->idprof4,$soc->pays_code); + print $formcompany->get_input_id_prof(4,'idprof4',$object->idprof4,$object->pays_code); print '  '.$langs->trans('VATIntra').''; - $s = ''; + $s = ''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -938,7 +940,7 @@ else } else { - $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; @@ -947,20 +949,20 @@ else // Type - Size print '
'.$langs->trans("ThirdPartyType").''."\n"; - print $form->selectarray("typent_id",$formcompany->typent_array(0), $soc->typent_id); + print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''.$langs->trans("Staff").''; - print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $soc->effectif_id); + print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('JuridicalStatus').''; - if ($soc->pays_id) + if ($object->pays_id) { - $formcompany->select_forme_juridique($soc->forme_juridique_code,$soc->pays_code); + $formcompany->select_forme_juridique($object->forme_juridique_code,$object->pays_code); } else { @@ -969,7 +971,7 @@ else print '
'.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("DefaultLang").''."\n"; - print $formadmin->select_language(($soc->default_lang?$soc->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); + print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); print '
'.$langs->trans("AllocateCommercial").''; - $form->select_users($soc->commercial_id,'commercial_id',1); + $form->select_users($object->commercial_id,'commercial_id',1); print '
'; // Name - print ''; + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; } // Prospect/Customer print ''; print ''; print ''; print ''; // Category - if ($conf->categorie->enabled && $soc->fournisseur) + if ($conf->categorie->enabled && $object->fournisseur) { - $load = $soc->LoadSupplierCateg(); + $load = $object->LoadSupplierCateg(); if ( $load == 0) { - if (sizeof($soc->SupplierCategories) > 0) + if (sizeof($object->SupplierCategories) > 0) { print ''; print ''; } } @@ -1264,31 +1266,31 @@ else // Status print ''; // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { - print ''; } // Address print ''; // Zip / Town print ''; // Country print ''; @@ -1296,54 +1298,54 @@ else if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''; } // Phone / Fax - print ''; - print ''; + print ''; + print ''; // EMail / Web - print ''; - print ''; + print ''; + print ''; print ''; // IdProf1 (SIREN for France) - $idprof=$langs->transcountry('ProfId1',$soc->pays_code); + $idprof=$langs->transcountry('ProfId1',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; // IdProf2 (SIRET for France) - $idprof=$langs->transcountry('ProfId2',$soc->pays_code); + $idprof=$langs->transcountry('ProfId2',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; print ''; print ''; // IdProf3 (APE for France) - $idprof=$langs->transcountry('ProfId3',$soc->pays_code); + $idprof=$langs->transcountry('ProfId3',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; // IdProf4 (NU for France) - $idprof=$langs->transcountry('ProfId4',$soc->pays_code); + $idprof=$langs->transcountry('ProfId4',$object->pays_code); if ($idprof!='-') { print ''; } else print ''; @@ -1351,13 +1353,13 @@ else // VAT payers print ''; // VAT Code print ''; print ''; } elseif($mysoc->localtax1_assuj=="1") { print ''; } elseif($mysoc->localtax2_assuj=="1") { print ''; } } // Type - Size print ''; print ''; print ''; // Capital - print ''; + print ''; // Default language if ($conf->global->MAIN_MULTILANGS) { print ''; print ''; } @@ -1441,7 +1443,7 @@ else // Other attributes foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$soc->array_options["options_$key"]); + $value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]); print "\n"; @@ -1451,13 +1453,13 @@ else print ''; print ''; print ''; print ''; print ''; // Logo $rowspan=4; if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++; - if ($soc->client) $rowspan++; - if ($conf->fournisseur->enabled && $soc->fournisseur) $rowspan++; + if ($object->client) $rowspan++; + if ($conf->fournisseur->enabled && $object->fournisseur) $rowspan++; if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++; if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; $showlogo=''; - if ($soc->logo) + if ($object->logo) { $showlogo.=''; } if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; print $showlogo; $showlogo=''; print ''; } - if ($soc->client) + if ($object->client) { print ''; print $showlogo; $showlogo=''; print ''; } - if ($conf->fournisseur->enabled && $soc->fournisseur) + if ($conf->fournisseur->enabled && $object->fournisseur) { print ''; print $showlogo; $showlogo=''; print ''; @@ -1570,8 +1572,8 @@ else // Status print ''; - print ''; print $showlogo; $showlogo=''; print ''; @@ -1579,66 +1581,66 @@ else // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { - print ''; + print ''; } // Address - print ""; // Zip / Town - print '"; print ''; // Country - print ''; // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) print ''; + if (empty($conf->global->SOCIETE_DISABLE_STATE)) print ''; - print ''; - print ''; + print ''; + print ''; // EMail print ''; // Web print ''; // ProfId1 (SIREN for France) - $profid=$langs->transcountry('ProfId1',$soc->pays_code); + $profid=$langs->transcountry('ProfId1',$object->pays_code); if ($profid!='-') { print ''; } else print ''; // ProfId2 (SIRET for France) - $profid=$langs->transcountry('ProfId2',$soc->pays_code); + $profid=$langs->transcountry('ProfId2',$object->pays_code); if ($profid!='-') { print ''; @@ -1646,28 +1648,28 @@ else else print ''; // ProfId3 (APE for France) - $profid=$langs->transcountry('ProfId3',$soc->pays_code); + $profid=$langs->transcountry('ProfId3',$object->pays_code); if ($profid!='-') { print ''; } else print ''; // ProfId4 (NU for France) - $profid=$langs->transcountry('ProfId4',$soc->pays_code); + $profid=$langs->transcountry('ProfId4',$object->pays_code); if ($profid!='-') { print ''; @@ -1679,16 +1681,16 @@ else print ''; // VAT Code print ''; } elseif($mysoc->localtax1_assuj=="1") { print ''; } elseif($mysoc->localtax2_assuj=="1") { print ''; } } // Type + Staff $arr = $formcompany->typent_array(1); - $soc->typent= $arr[$soc->typent_code]; - print ''; + $object->typent= $arr[$object->typent_code]; + print ''; // Legal - print ''; + print ''; // Capital print ''; @@ -1766,10 +1768,10 @@ else { require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); print ''; } @@ -1777,7 +1779,7 @@ else // Other attributes foreach($extrafields->attribute_label as $key=>$label) { - $value=$soc->array_options["options_$key"]; + $value=$object->array_options["options_$key"]; print "\n"; @@ -1791,13 +1793,13 @@ else print $langs->trans('RIB'); print '
'.$langs->trans('ThirdPartyName').'
'.$langs->trans('ThirdPartyName').'
'.$langs->trans("Prefix").''; // It does not change the prefix mode using the auto numbering prefix - if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $soc->prefix_comm) + if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { - print ''; - print $soc->prefix_comm; + print ''; + print $object->prefix_comm; } else { - print ''; + print ''; } print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; print '
'; - if ((!$soc->code_client || $soc->code_client == -1) && $modCodeClient->code_auto) + if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) { - $tmpcode=$soc->code_client; - if (empty($tmpcode) && $modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($soc,0); + $tmpcode=$object->code_client; + if (empty($tmpcode) && $modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($object,0); print ''; } - else if ($soc->codeclient_modifiable()) + else if ($object->codeclient_modifiable()) { - print ''; + print ''; } else { - print $soc->code_client; - print ''; + print $object->code_client; + print ''; } print ''; - $s=$modCodeClient->getToolTip($langs,$soc,0); + $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); print '
'; @@ -1218,44 +1220,44 @@ else { print '
'.$langs->trans('Supplier').''; - print $form->selectyesno("fournisseur",$soc->fournisseur,1); + print $form->selectyesno("fournisseur",$object->fournisseur,1); print ''.$langs->trans('SupplierCode').''; print '
'; - if ((!$soc->code_fournisseur || $soc->code_fournisseur == -1) && $modCodeFournisseur->code_auto) + if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { - $tmpcode=$soc->code_fournisseur; - if (empty($tmpcode) && $modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($soc,1); + $tmpcode=$object->code_fournisseur; + if (empty($tmpcode) && $modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($object,1); print ''; } - else if ($soc->codefournisseur_modifiable()) + else if ($object->codefournisseur_modifiable()) { - print ''; + print ''; } else { - print $soc->code_fournisseur; - print ''; + print $object->code_fournisseur; + print ''; } print ''; - $s=$modCodeFournisseur->getToolTip($langs,$soc,1); + $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); print '
'; print '
'.$langs->trans('SupplierCategory').''; - print $form->selectarray("fournisseur_categorie",$soc->SupplierCategories,'',1); + print $form->selectarray("fournisseur_categorie",$object->SupplierCategories,'',1); print '
'.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$soc->status); + print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status); print '
'.$langs->trans('Gencod').''; + print '
'.$langs->trans('Gencod').''; print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($soc->cp,'zipcode',array('town','selectpays_id','departement_id'),6); + print $formcompany->select_ziptown($object->cp,'zipcode',array('town','selectpays_id','departement_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($soc->ville,'town',array('zipcode','selectpays_id','departement_id')); + print $formcompany->select_ziptown($object->ville,'town',array('zipcode','selectpays_id','departement_id')); print '
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id,'pays_id'); + $form->select_pays($object->pays_id,'pays_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; - $formcompany->select_departement($soc->departement_id,$soc->pays_code); + $formcompany->select_departement($object->departement_id,$object->pays_code); print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$idprof.''; - print $formcompany->get_input_id_prof(1,'idprof1',$soc->siren,$soc->pays_code); + print $formcompany->get_input_id_prof(1,'idprof1',$object->siren,$object->pays_code); print '  '.$idprof.''; - print $formcompany->get_input_id_prof(2,'idprof2',$soc->siret,$soc->pays_code); + print $formcompany->get_input_id_prof(2,'idprof2',$object->siret,$object->pays_code); print '  
'.$idprof.''; - print $formcompany->get_input_id_prof(3,'idprof3',$soc->ape,$soc->pays_code); + print $formcompany->get_input_id_prof(3,'idprof3',$object->ape,$object->pays_code); print '  '.$idprof.''; - print $formcompany->get_input_id_prof(4,'idprof4',$soc->idprof4,$soc->pays_code); + print $formcompany->get_input_id_prof(4,'idprof4',$object->idprof4,$object->pays_code); print '  
'.$langs->trans('VATIsUsed').''; - print $form->selectyesno('assujtva_value',$soc->tva_assuj,1); + print $form->selectyesno('assujtva_value',$object->tva_assuj,1); print ''.$langs->trans('VATIntra').''; - $s =''; + $s =''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -1377,7 +1379,7 @@ else } else { - $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; @@ -1391,49 +1393,49 @@ else if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { print '
'.$langs->trans("LocalTax1IsUsedES").''; - print $form->selectyesno('localtax1assuj_value',$soc->localtax1_assuj,1); + print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print ''.$langs->trans("LocalTax2IsUsedES").''; - print $form->selectyesno('localtax2assuj_value',$soc->localtax2_assuj,1); + print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print '
'.$langs->trans("LocalTax1IsUsedES").''; - print $form->selectyesno('localtax1assuj_value',$soc->localtax1_assuj,1); + print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print '
'.$langs->trans("LocalTax2IsUsedES").''; - print $form->selectyesno('localtax2assuj_value',$soc->localtax2_assuj,1); + print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print '
'.$langs->trans("ThirdPartyType").''; - print $form->selectarray("typent_id",$formcompany->typent_array(0), $soc->typent_id); + print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''.$langs->trans("Staff").''; - print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $soc->effectif_id); + print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('JuridicalStatus').''; - $formcompany->select_forme_juridique($soc->forme_juridique_code,$soc->pays_code); + $formcompany->select_forme_juridique($object->forme_juridique_code,$object->pays_code); print '
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("DefaultLang").''."\n"; - print $formadmin->select_language($soc->default_lang,'default_lang',0,0,1); + print $formadmin->select_language($object->default_lang,'default_lang',0,0,1); print '
".$label.""; print $extrafields->showInputField($key,$value); print "
'.$langs->trans("Logo").''; - if ($soc->logo) print $form->showphoto('societe',$soc,50); + if ($object->logo) print $form->showphoto('societe',$object,50); $caneditfield=1; if ($caneditfield) { - if ($soc->logo) print "
\n"; + if ($object->logo) print "
\n"; print ''; - if ($soc->logo) print ''; + if ($object->logo) print ''; //print ''; print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; @@ -1482,14 +1484,14 @@ else /* * View */ - $soc = new Societe($db); - $res=$soc->fetch($socid); - if ($res < 0) { dol_print_error($db,$soc->error); exit; } - $res=$soc->fetch_optionals($socid,$extralabels); + $object = new Societe($db); + $res=$object->fetch($socid); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($socid,$extralabels); if ($res < 0) { dol_print_error($db); exit; } - $head = societe_prepare_head($soc); + $head = societe_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); @@ -1500,7 +1502,7 @@ else if ($action == 'delete' || $conf->use_javascript_ajax) { $html = new Form($db); - $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete"); + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete"); if ($ret == 'html') print '
'; } @@ -1520,49 +1522,49 @@ else // Name print '
'.$langs->trans('ThirdPartyName').''; - print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom'); + print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'; - $showlogo.=$html->showphoto('societe',$soc,50); + $showlogo.=$html->showphoto('societe',$object,50); $showlogo.='
'.$langs->trans('Prefix').''.$soc->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print $langs->trans('CustomerCode').''; + print $object->code_client; + if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print '
'; - print $langs->trans('SupplierCode').''; - print $soc->code_fournisseur; - if ($soc->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
'.$langs->trans("Status").''; - print $soc->getLibStatut(2); + print ''; + print $object->getLibStatut(2); print '
'.$langs->trans('Gencod').''.$soc->gencod.'
'.$langs->trans('Gencod').''.$object->gencod.'
".$langs->trans('Address').''; - dol_print_address($soc->address,'gmap','thirdparty',$soc->id); + print "
".$langs->trans('Address').''; + dol_print_address($object->address,'gmap','thirdparty',$object->id); print "
'.$langs->trans('Zip').' / '.$langs->trans("Town").''; - print $soc->cp.($soc->cp && $soc->ville?" / ":"").$soc->ville; + print '
'.$langs->trans('Zip').' / '.$langs->trans("Town").''; + print $object->cp.($object->cp && $object->ville?" / ":"").$object->ville; print "
'.$langs->trans("Country").''; - $img=picto_from_langcode($soc->pays_code); - if ($soc->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$soc->pays,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$soc->pays; + print '
'.$langs->trans("Country").''; + $img=picto_from_langcode($object->pays_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->pays,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->pays; print '
'.$langs->trans('State').''.$soc->departement.'
'.$langs->trans('State').''.$object->departement.'
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'
'.$langs->trans('Phone').''.dol_print_phone($object->tel,$object->pays_code,0,$object->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->pays_code,0,$object->id,'AC_FAX').'
'.$langs->trans('EMail').''; - print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL'); + print dol_print_email($object->email,0,$object->id,'AC_EMAIL'); print ''.$langs->trans('Web').''; - print dol_print_url($soc->url); + print dol_print_url($object->url); print '
'.$profid.''; - print $soc->siren; - if ($soc->siren) + print $object->siren; + if ($object->siren) { - if ($soc->id_prof_check(1,$soc) > 0) print '   '.$soc->id_prof_url(1,$soc); + if ($object->id_prof_check(1,$object) > 0) print '   '.$object->id_prof_url(1,$object); else print ' ('.$langs->trans("ErrorWrongValue").')'; } print '
  '.$profid.''; - print $soc->siret; - if ($soc->siret) + print $object->siret; + if ($object->siret) { - if ($soc->id_prof_check(2,$soc) > 0) print '   '.$soc->id_prof_url(2,$soc); + if ($object->id_prof_check(2,$object) > 0) print '   '.$object->id_prof_url(2,$object); else print ' ('.$langs->trans("ErrorWrongValue").')'; } print '
  
'.$profid.''; - print $soc->ape; - if ($soc->ape) + print $object->ape; + if ($object->ape) { - if ($soc->id_prof_check(3,$soc) > 0) print '   '.$soc->id_prof_url(3,$soc); + if ($object->id_prof_check(3,$object) > 0) print '   '.$object->id_prof_url(3,$object); else print ' ('.$langs->trans("ErrorWrongValue").')'; } print '
  '.$profid.''; - print $soc->idprof4; - if ($soc->idprof4) + print $object->idprof4; + if ($object->idprof4) { - if ($soc->id_prof_check(4,$soc) > 0) print '   '.$soc->id_prof_url(4,$soc); + if ($object->id_prof_check(4,$object) > 0) print '   '.$object->id_prof_url(4,$object); else print ' ('.$langs->trans("ErrorWrongValue").')'; } print '
'; print $langs->trans('VATIsUsed'); print ''; - print yn($soc->tva_assuj); + print yn($object->tva_assuj); print ''.$langs->trans('VATIntra').''; - if ($soc->tva_intra) + if ($object->tva_intra) { $s=''; - $s.=$soc->tva_intra; - $s.=''; + $s.=$object->tva_intra; + $s.=''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -1708,7 +1710,7 @@ else } else { - $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; @@ -1727,37 +1729,37 @@ else if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { print '
'.$langs->trans("LocalTax1IsUsedES").''; - print yn($soc->localtax1_assuj); + print yn($object->localtax1_assuj); print ''.$langs->trans("LocalTax2IsUsedES").''; - print yn($soc->localtax2_assuj); + print yn($object->localtax2_assuj); print '
'.$langs->trans("LocalTax1IsUsedES").''; - print yn($soc->localtax1_assuj); + print yn($object->localtax1_assuj); print '
'.$langs->trans("LocalTax2IsUsedES").''; - print yn($soc->localtax2_assuj); + print yn($object->localtax2_assuj); print '
'.$langs->trans("ThirdPartyType").''.$soc->typent.''.$langs->trans("Staff").''.$soc->effectif.'
'.$langs->trans("ThirdPartyType").''.$object->typent.''.$langs->trans("Staff").''.$object->effectif.'
'.$langs->trans('JuridicalStatus').''.$soc->forme_juridique.'
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; - if ($soc->capital) print $soc->capital.' '.$langs->trans("Currency".$conf->monnaie); + if ($object->capital) print $object->capital.' '.$langs->trans("Currency".$conf->monnaie); else print ' '; print '
'.$langs->trans("DefaultLang").''; - //$s=picto_from_langcode($soc->default_lang); + //$s=picto_from_langcode($object->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); - $labellang = ($soc->default_lang?$langs->trans('Language_'.$soc->default_lang):''); + $labellang = ($object->default_lang?$langs->trans('Language_'.$object->default_lang):''); print $labellang; print '
".$label.''; print $extrafields->showOutputField($key,$value); print "
'; if ($user->rights->societe->creer) - print ''.img_edit().''; + print ''.img_edit().''; else print ' '; print '
'; print ''; print ''; - print $soc->display_rib(); + print $object->display_rib(); print ''; } @@ -1809,16 +1811,16 @@ else print $langs->trans('ParentCompany'); print ''; if ($user->rights->societe->creer) - print ''.img_edit() .''; + print ''.img_edit() .''; else print ' '; print ''; print ''; print ''; - if ($soc->parent) + if ($object->parent) { $socm = new Societe($db); - $socm->fetch($soc->parent); + $socm->fetch($object->parent); print $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); print $socm->ville?' - '.$socm->ville:''; } @@ -1834,18 +1836,18 @@ else print $langs->trans('SalesRepresentatives'); print ''; if ($user->rights->societe->creer) - print ''.img_edit().''; + print ''.img_edit().''; else print ' '; print ''; print ''; print ''; - $listsalesrepresentatives=$soc->getSalesRepresentatives($user); + $listsalesrepresentatives=$object->getSalesRepresentatives($user); $nbofsalesrepresentative=sizeof($listsalesrepresentatives); if ($nbofsalesrepresentative > 3) // We print only number { - print ''; + print ''; print $nbofsalesrepresentative; print ''; } @@ -1873,7 +1875,7 @@ else print ''.$langs->trans("LinkedToDolibarrMember").''; print ''; $adh=new Adherent($db); - $result=$adh->fetch('','',$soc->id); + $result=$adh->fetch('','',$object->id); if ($result > 0) { $adh->ref=$adh->getFullName($langs); @@ -1899,18 +1901,18 @@ else if ($user->rights->societe->creer) { - print ''.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } /*if ($user->rights->societe->contact->creer) { - print ''.$langs->trans("AddContact").''."\n"; + print ''.$langs->trans("AddContact").''."\n"; } */ /*if ($conf->projet->enabled && $user->rights->projet->creer) { - print ''.$langs->trans("AddProject").''."\n"; + print ''.$langs->trans("AddProject").''."\n"; }*/ if ($user->rights->societe->supprimer) @@ -1921,7 +1923,7 @@ else } else { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } } @@ -1936,14 +1938,14 @@ else /* * Documents generes */ - $filedir=$conf->societe->dir_output.'/'.$soc->id; - $urlsource=$_SERVER["PHP_SELF"]."?socid=".$soc->id; + $filedir=$conf->societe->dir_output.'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; $genallowed=$user->rights->societe->creer; $delallowed=$user->rights->societe->supprimer; $var=true; - $somethingshown=$formfile->show_documents('company',$soc->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$soc->default_lang); + $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); print ''; print ''; @@ -1954,16 +1956,16 @@ else } // Subsidiaries list - $result=show_subsidiaries($conf,$langs,$db,$soc); + $result=show_subsidiaries($conf,$langs,$db,$object); // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - $result=show_contacts($conf,$langs,$db,$soc,$_SERVER["PHP_SELF"].'?socid='.$soc->id); + $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } // Projects list - $result=show_projects($conf,$langs,$db,$soc,$_SERVER["PHP_SELF"].'?socid='.$soc->id); + $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } } @@ -1971,5 +1973,5 @@ else $db->close(); -llxFooter('$Date: 2011/07/02 13:09:53 $ - $Revision: 1.117 $'); +llxFooter('$Date: 2011/07/02 14:12:44 $ - $Revision: 1.118 $'); ?> \ No newline at end of file