* Copyright (C) 2003 Brian Fraval * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/societe/soc.php * \ingroup societe * \brief Third party card page */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); if ($conf->adherent->enabled) require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); $langs->load("companies"); $langs->load("commercial"); $langs->load("bills"); $langs->load("banks"); $langs->load("users"); if ($conf->notification->enabled) $langs->load("mails"); $mesg=''; $error=0; $errors=array(); $action = (GETPOST('action') ? GETPOST('action') : 'view'); $confirm = GETPOST('confirm'); $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $object = new Societe($db); $extrafields = new ExtraFields($db); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($socid); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); if (! empty($canvas)) { require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); $objcanvas = new Canvas($db, $action); $objcanvas->getCanvas('thirdparty', 'card', $canvas); } // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($db); $hookmanager->initHooks(array('thirdpartycard')); /* * Actions */ $parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); if (empty($reshook)) { if ($_POST["getcustomercode"]) { // We defined value code_client $_POST["code_client"]="Acompleter"; } if ($_POST["getsuppliercode"]) { // We defined value code_fournisseur $_POST["code_fournisseur"]="Acompleter"; } // Add new third party if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) { require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); if ($action == 'update') { $ret=$object->fetch($socid); $object->oldcopy=dol_clone($object); } else $object->canvas=$canvas; if (GETPOST("private") == 1) { $object->particulier = GETPOST("private"); $object->name = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]); $object->civilite_id = $_POST["civilite_id"]; // Add non official properties $object->name_bis = $_POST["nom"]; $object->firstname = $_POST["prenom"]; } else { $object->name = $_POST["nom"]; } $object->address = $_POST["adresse"]; $object->zip = $_POST["zipcode"]; $object->town = $_POST["town"]; $object->country_id = $_POST["country_id"]; $object->state_id = $_POST["departement_id"]; $object->tel = $_POST["tel"]; $object->fax = $_POST["fax"]; $object->email = trim($_POST["email"]); $object->url = trim($_POST["url"]); $object->idprof1 = $_POST["idprof1"]; $object->idprof2 = $_POST["idprof2"]; $object->idprof3 = $_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->barcode = $_POST["barcode"]; $object->tva_intra = $_POST["tva_intra"]; $object->tva_assuj = $_POST["assujtva_value"]; $object->status = $_POST["status"]; // Local Taxes $object->localtax1_assuj = $_POST["localtax1assuj_value"]; $object->localtax2_assuj = $_POST["localtax2assuj_value"]; $object->forme_juridique_code = $_POST["forme_juridique_code"]; $object->effectif_id = $_POST["effectif_id"]; if (GETPOST("private") == 1) { $object->typent_id = 8; // TODO predict another method if the field "special" change of rowid } else { $object->typent_id = $_POST["typent_id"]; } $object->client = $_POST["client"]; $object->fournisseur = $_POST["fournisseur"]; $object->fournisseur_categorie = $_POST["fournisseur_categorie"]; $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)) { $object->array_options[$key]=$_POST[$key]; } } 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($object->email) && ! isValidEMail($object->email)) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorBadEMail",$object->email); $action = ($action=='add'?'create':'edit'); } if (! empty($object->url) && ! isValidUrl($object->url)) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorBadUrl",$object->url); $action = ($action=='add'?'create':'edit'); } if ($object->fournisseur && ! $conf->fournisseur->enabled) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled"); $action = ($action=='add'?'create':'edit'); } // Check for duplicate prof id for ($i = 1; $i < 3; $i++) { $slabel="idprof".$i; $_POST[$slabel]=trim($_POST[$slabel]); $vallabel=$_POST[$slabel]; if ($vallabel && $object->id_prof_verifiable($i)) { if($object->id_prof_exists($i,$vallabel,$object->id)) { $langs->load("errors"); $error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel); $action = ($action=='add'?'create':'edit'); } } } } if (! $error) { if ($action == 'add') { $db->begin(); if (empty($object->client)) $object->code_client=''; if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); if ($result >= 0) { if ($object->particulier) { dol_syslog("This thirdparty is a personal people",LOG_DEBUG); $contact=new Contact($db); $contact->civilite_id = $object->civilite_id; $contact->name = $object->name_bis; $contact->firstname = $object->firstname; $contact->address = $object->address; $contact->zip = $object->zip; $contact->town = $object->town; $contact->state_id = $object->state_id; $contact->country_id = $object->country_id; $contact->socid = $object->id; // fk_soc $contact->status = 1; $contact->email = $object->email; $contact->phone_pro = $object->tel; $contact->fax = $object->fax; $contact->priv = 0; $result=$contact->create($user); if (! $result >= 0) { $error=$contact->error; $errors=$contact->errors; } } // Gestion du logo de la société $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (image_format_supported($_FILES['photo']['name'])) { dol_mkdir($dir); if (@is_dir($dir)) { $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); if (! $result > 0) { $errors[] = "ErrorFailedToSaveFile"; } else { // Create small thumbs for company (Ratio is near 16/9) // Used on logon for example $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); // Create mini thumbs for company (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); } } } } // Gestion du logo de la société } else { $error=$object->error; $errors=$object->errors; } if ($result >= 0) { $db->commit(); $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; } else { $db->rollback(); $action='create'; } } if ($action == 'update') { if ($_POST["cancel"]) { Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } // To not set code if third party is not concerned. But if it had values, we keep them. 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($object);exit; $result = $object->update($socid,$user,1,$object->oldcopy->codeclient_modifiable(),$object->oldcopy->codefournisseur_modifiable()); if ($result <= 0) { $error = $object->error; $errors = $object->errors; } // Gestion du logo de la société $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (GETPOST('deletephoto')) { $fileimg=$dir.'/'.$object->logo; $dirthumbs=$dir.'/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } if (image_format_supported($_FILES['photo']['name']) > 0) { dol_mkdir($dir); if (@is_dir($dir)) { $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); if (! $result > 0) { $errors[] = "ErrorFailedToSaveFile"; } else { // Create small thumbs for company (Ratio is near 16/9) // Used on logon for example $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); // Create mini thumbs for company (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); } } } else { $errors[] = "ErrorBadImageFormat"; } } // Gestion du logo de la société if (! $error && ! count($errors)) { Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } else { $object->id = $socid; $action= "edit"; } } } } // Delete third party if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { $object->fetch($socid); $result = $object->delete($socid); if ($result > 0) { Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".urlencode($object->name)); exit; } else { $langs->load("errors"); $error=$langs->trans($object->error); $errors = $object->errors; $action=''; } } /* * Generate document */ if ($action == 'builddoc') // En get ou en post { if (is_numeric(GETPOST('model'))) { $error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model")); } else { require_once(DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'); $object->fetch($socid); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fac->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } $result=thirdparty_doc_create($db, $object, '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { dol_print_error($db,$result); exit; } else { Header('Location: '.$_SERVER["PHP_SELF"].'?socid='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); exit; } } } // Remove file in doc form else if ($action == 'remove_file') { if ($object->fetch($socid)) { require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); $langs->load("other"); $upload_dir = $conf->societe->dir_output; $file = $upload_dir . '/' . GETPOST('file'); dol_delete_file($file,0,0,0,$object); $mesg = '
'.$langs->trans("FileWasRemoved",GETPOST('file')).'
'; } } } /* * View */ // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label('company'); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); $form = new Form($db); $formfile = new FormFile($db); $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used with CANVAS // ----------------------------------------- if (! $objcanvas->hasActions() && $socid) { $object = new Societe($db); $object->fetch($socid); // For use with "pure canvas" (canvas that contains templates only) } $objcanvas->assign_values($action, $socid); // Set value for templates $objcanvas->display_canvas($action); // Show template } else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- if ($action == 'create') { /* * Creation */ // Load object modCodeTiers $module=$conf->global->SOCIETE_CODECLIENT_ADDON; if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined")); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); } $dirsociete=array_merge(array('/core/modules/societe/'),$conf->societe_modules); foreach ($dirsociete as $dirroot) { $res=dol_include_once($dirroot.$module.".php"); if ($res) break; } $modCodeClient = new $module; $module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON; if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); } $dirsociete=array_merge(array('/core/modules/societe/'),$conf->societe_modules); foreach ($dirsociete as $dirroot) { $res=dol_include_once($dirroot.$module.".php"); if ($res) break; } $modCodeFournisseur = new $module; //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; } $object->name = $_POST["nom"]; $object->firstname = $_POST["prenom"]; $object->particulier = GETPOST('private', 'int'); $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->address = $_POST["adresse"]; $object->zip = $_POST["zipcode"]; $object->town = $_POST["town"]; $object->state_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->barcode = $_POST["barcode"]; $object->idprof1 = $_POST["idprof1"]; $object->idprof2 = $_POST["idprof2"]; $object->idprof3 = $_POST["idprof3"]; $object->idprof4 = $_POST["idprof4"]; $object->typent_id = $_POST["typent_id"]; $object->effectif_id = $_POST["effectif_id"]; $object->civility_id = $_POST["civilite_id"]; $object->tva_assuj = $_POST["assujtva_value"]; $object->status = $_POST["status"]; //Local Taxes $object->localtax1_assuj = $_POST["localtax1assuj_value"]; $object->localtax2_assuj = $_POST["localtax2assuj_value"]; $object->tva_intra = $_POST["tva_intra"]; $object->commercial_id = $_POST["commercial_id"]; $object->default_lang = $_POST["default_lang"]; $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); // Gestion du logo de la société $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (image_format_supported($_FILES['photo']['name'])) { dol_mkdir($dir); if (@is_dir($dir)) { $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); if (! $result > 0) { $errors[] = "ErrorFailedToSaveFile"; } else { // Create small thumbs for company (Ratio is near 16/9) // Used on logon for example $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); // Create mini thumbs for company (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); } } } } // We set country_id, country_code and country for the selected country $object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; if ($object->country_id) { $tmparray=getCountry($object->country_id,'all'); $object->country_code=$tmparray['code']; $object->country=$tmparray['label']; } $object->forme_juridique_code=$_POST['forme_juridique_code']; /* Show create form */ print_fiche_titre($langs->trans("NewCompany")); if ($conf->use_javascript_ajax) { print "\n".''."\n"; print "
\n"; print $langs->trans("ThirdPartyType").':   '; print ' '.$langs->trans("Company/Fundation"); print '     '; print ' '.$langs->trans("Individual"); print ' ('.$langs->trans("ToCreateContactWithSameName").')'; print "
\n"; print "
\n"; } dol_htmloutput_errors($error,$errors); print '
'; print ''; print ''; print ''; print ''; print ''; print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; print ''; // Name, firstname if ($object->particulier || GETPOST("private")) { print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; } print ''; } else { print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; } print ''; } // If javascript on, we show option individual if ($conf->use_javascript_ajax) { print ''; print ''; print ''; print ''; } // Prospect/Customer print ''; print ''; if ($conf->fournisseur->enabled && ! empty($user->rights->fournisseur->lire)) { // Supplier print ''; print ''; print ''; // Category if ($object->fournisseur) { $load = $object->LoadSupplierCateg(); if ( $load == 0) { if (count($object->SupplierCategories) > 0) { print ''; print ''; } } } } // Status print ''; // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { print ''; } // Address print ''; // Zip / Town print ''; // Country print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''; } // Phone / Fax print ''; print ''; print ''; print ''; // Prof ids $i=1; $j=0; while ($i <= 6) { $idprof=$langs->transcountry('ProfId'.$i,$object->country_code); if ($idprof!='-') { if (($j % 2) == 0) print ''; print ''; if (($j % 2) == 1) print ''; $j++; } $i++; } if ($j % 2 == 1) print ''; // Assujeti TVA $form = new Form($db); print ''; print ''; print ''; print ''; print ''; // Type - Size print ''; print ''; // Legal Form print ''; print ''; // Capital print ''; // Local Taxes // TODO add specific function by country if($mysoc->country_code=='ES') { if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { print ''; } elseif($mysoc->localtax1_assuj=="1") { print ''; } elseif($mysoc->localtax2_assuj=="1") { print ''; } } if ($conf->global->MAIN_MULTILANGS) { print ''; print ''; } if ($user->rights->societe->client->voir) { // Assign a Name print ''; print ''; print ''; } // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); print ''."\n"; } } // Ajout du logo print ''; print ''; print ''; print ''; print '
'.$langs->trans('LastName').''.$langs->trans('Prefix').'
'.$langs->trans('ThirdPartyName').''.$langs->trans('Prefix').'
'.$langs->trans('FirstName').' 
'.$langs->trans("UserTitle").''; print $formcompany->select_civility($object->civility_id).' 
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; print '
'; $tmpcode=$object->code_client; if ($modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($object,0); print ''; print ''; $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); print '
'; print '
'.$langs->trans('Supplier').''; print $form->selectyesno("fournisseur",(isset($_POST['fournisseur'])?GETPOST('fournisseur'):$object->fournisseur),1); print ''.$langs->trans('SupplierCode').''; print '
'; $tmpcode=$object->code_fournisseur; if ($modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($object,1); print ''; print ''; $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); print '
'; print '
'.$langs->trans('SupplierCategory').''; print $form->selectarray("fournisseur_categorie",$object->SupplierCategories,$_POST["fournisseur_categorie"],1); print '
'.$langs->trans('Status').''; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); print '
'.$langs->trans('Gencod').''; print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); print ''.$langs->trans('Town').''; print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); print '
'.$langs->trans('Country').''; print $form->select_country($object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'departement_id'); else print $countrynotdefined; print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$idprof.''; $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '
'.$langs->trans('VATIsUsed').''; print $form->selectyesno('assujtva_value',1,1); // Assujeti par defaut en creation print ''.$langs->trans('VATIntra').''; $s = ''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { $s.=' '; if ($conf->use_javascript_ajax) { print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); } else { $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; print '
'.$langs->trans("ThirdPartyType").''."\n"; 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), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('JuridicalStatus').''; if ($object->country_id) { $formcompany->select_forme_juridique($object->forme_juridique_code,$object->country_code); } else { print $countrynotdefined; } print '
'.$langs->trans('Capital').' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("LocalTax1IsUsedES").''; print $form->selectyesno('localtax1assuj_value',0,1); print ''.$langs->trans("LocalTax2IsUsedES").''; print $form->selectyesno('localtax2assuj_value',0,1); print '
'.$langs->trans("LocalTax1IsUsedES").''; print $form->selectyesno('localtax1assuj_value',0,1); print '
'.$langs->trans("LocalTax2IsUsedES").''; print $form->selectyesno('localtax2assuj_value',0,1); print '
'.$langs->trans("DefaultLang").''."\n"; 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($object->commercial_id,'commercial_id',1); print '
'.$label.''; print $extrafields->showInputField($key,$value); print '
'.$langs->trans("Logo").''; print ''; print '
'."\n"; print '
'; print ''; print '
'."\n"; print '
'."\n"; } elseif ($action == 'edit') { /* * Edition */ //print_fiche_titre($langs->trans("EditCompany")); if ($socid) { $object = new Societe($db); $res=$object->fetch($socid); if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } $head = societe_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); // Load object modCodeTiers $module=$conf->global->SOCIETE_CODECLIENT_ADDON; if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined")); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); } $dirsociete=array_merge(array('/core/modules/societe/'),$conf->societe_modules); foreach ($dirsociete as $dirroot) { $res=dol_include_once($dirroot.$module.".php"); if ($res) break; } $modCodeClient = new $module; // We verified if the tag prefix is used if ($modCodeClient->code_auto) { $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed(); } $module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON; if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); } $dirsociete=array_merge(array('/core/modules/societe/'),$conf->societe_modules); foreach ($dirsociete as $dirroot) { $res=dol_include_once($dirroot.$module.".php"); if ($res) break; } $modCodeFournisseur = new $module; // On verifie si la balise prefix est utilisee if ($modCodeFournisseur->code_auto) { $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed(); } if (! empty($_POST["nom"])) { // We overwrite with values if posted $object->name = $_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->address = $_POST["adresse"]; $object->zip = $_POST["zipcode"]; $object->town = $_POST["town"]; $object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $object->state_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->idprof1 = $_POST["idprof1"]; $object->idprof2 = $_POST["idprof2"]; $object->idprof3 = $_POST["idprof3"]; $object->idprof4 = $_POST["idprof4"]; $object->typent_id = $_POST["typent_id"]; $object->effectif_id = $_POST["effectif_id"]; $object->barcode = $_POST["barcode"]; $object->forme_juridique_code = $_POST["forme_juridique_code"]; $object->default_lang = $_POST["default_lang"]; $object->tva_assuj = $_POST["assujtva_value"]; $object->tva_intra = $_POST["tva_intra"]; $object->status = $_POST["status"]; //Local Taxes $object->localtax1_assuj = $_POST["localtax1assuj_value"]; $object->localtax2_assuj = $_POST["localtax2assuj_value"]; // We set country_id, and pays_code label of the chosen country // TODO move to DAO class if ($object->country_id) { $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$object->country_id; $resql=$db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); } else { dol_print_error($db); } $object->country_code = $obj->code; $object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; } } dol_htmloutput_errors($error,$errors); if ($conf->use_javascript_ajax) { print "\n".''."\n"; } print '
'; print ''; print ''; print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; print ''; // Name print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; } // Prospect/Customer print ''; print ''; // Supplier if ($conf->fournisseur->enabled && ! empty($user->rights->fournisseur->lire)) { print ''; print ''; print ''; // Category if ($conf->categorie->enabled && $object->fournisseur) { $load = $object->LoadSupplierCateg(); if ( $load == 0) { if (count($object->SupplierCategories) > 0) { print ''; print ''; } } } } // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { print ''; } // Status print ''; // Address print ''; // Zip / Town print ''; // Country print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''; } // Phone / Fax print ''; print ''; // EMail / Web print ''; print ''; // Prof ids $i=1; $j=0; while ($i <= 6) { $idprof=$langs->transcountry('ProfId'.$i,$object->country_code); if ($idprof!='-') { if (($j % 2) == 0) print ''; print ''; if (($j % 2) == 1) print ''; $j++; } $i++; } if ($j % 2 == 1) print ''; // VAT payers print ''; // VAT Code print ''; print ''; print ''; // Local Taxes // TODO add specific function by country if($mysoc->country_code=='ES') { if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { print ''; } elseif($mysoc->localtax1_assuj=="1") { print ''; } elseif($mysoc->localtax2_assuj=="1") { print ''; } } // Type - Size print ''; print ''; print ''; // Capital print ''; // Default language if ($conf->global->MAIN_MULTILANGS) { print ''; print ''; } // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); print '\n"; } } // Logo print ''; print ''; print ''; print ''; print '
'.$langs->trans('ThirdPartyName').'
'.$langs->trans("Prefix").''; // It does not change the prefix mode using the auto numbering prefix if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { print ''; print $object->prefix_comm; } else { print ''; } print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; print '
'; if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) { $tmpcode=$object->code_client; if (empty($tmpcode) && $modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($object,0); print ''; } else if ($object->codeclient_modifiable()) { print ''; } else { print $object->code_client; print ''; } print ''; $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); print '
'; print '
'.$langs->trans('Supplier').''; print $form->selectyesno("fournisseur",$object->fournisseur,1); print ''.$langs->trans('SupplierCode').''; print '
'; if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { $tmpcode=$object->code_fournisseur; if (empty($tmpcode) && $modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($object,1); print ''; } else if ($object->codefournisseur_modifiable()) { print ''; } else { print $object->code_fournisseur; print ''; } print ''; $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); print '
'; print '
'.$langs->trans('SupplierCategory').''; print $form->selectarray("fournisseur_categorie",$object->SupplierCategories,'',1); print '
'.$langs->trans('Gencod').''; print '
'.$langs->trans("Status").''; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status); print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); print ''.$langs->trans('Town').''; print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); print '
'.$langs->trans('Country').''; print $form->select_country($object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; print $formcompany->select_state($object->state_id,$object->country_code); print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$idprof.''; $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '
'.$langs->trans('VATIsUsed').''; print $form->selectyesno('assujtva_value',$object->tva_assuj,1); print ''.$langs->trans('VATIntra').''; $s =''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { $s.='   '; if ($conf->use_javascript_ajax) { print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); } else { $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; print '
'.$langs->trans("LocalTax1IsUsedES").''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print ''.$langs->trans("LocalTax2IsUsedES").''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print '
'.$langs->trans("LocalTax1IsUsedES").''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print '
'.$langs->trans("LocalTax2IsUsedES").''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print '
'.$langs->trans("ThirdPartyType").''; 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), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('JuridicalStatus').''; $formcompany->select_forme_juridique($object->forme_juridique_code,$object->country_code); print '
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("DefaultLang").''."\n"; print $formadmin->select_language($object->default_lang,'default_lang',0,0,1); print '
'.$label.''; print $extrafields->showInputField($key,$value); print "
'.$langs->trans("Logo").''; if ($object->logo) print $form->showphoto('societe',$object,50); $caneditfield=1; if ($caneditfield) { if ($object->logo) print "
\n"; print ''; if ($object->logo) print ''; //print ''; print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; } print '
'; print '
'; print '
'; print ''; print '     '; print ''; print '
'; print '
'; dol_fiche_end(); } } else { /* * View */ $object = new Societe($db); $res=$object->fetch($socid); if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } $head = societe_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); // Confirm delete third party if ($action == 'delete' || $conf->use_javascript_ajax) { $form = new Form($db); $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete"); if ($ret == 'html') print '
'; } dol_htmloutput_errors($error,$errors); $showlogo=$object->logo; $showbarcode=($conf->barcode->enabled && $user->rights->barcode->lire); print ''; // Ref /* print ''; print ''; print ''; */ // Name print ''; print ''; print ''; // Logo+barcode $rowspan=4; if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++; if ($object->client) $rowspan++; if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++; if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++; if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; $htmllogobar=''; if ($showlogo || $showbarcode) { $htmllogobar.=''; } // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; print $htmllogobar; $htmllogobar=''; print ''; } // Customer code if ($object->client) { print ''; print $htmllogobar; $htmllogobar=''; print ''; } // Supplier code if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) { print ''; print $htmllogobar; $htmllogobar=''; print ''; } // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { print ''; print $htmllogobar; $htmllogobar=''; print ''; } // Status print ''; print ''; print $htmllogobar; $htmllogobar=''; print ''; // Address print ""; // Zip / Town print '"; print ''; // Country print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) print ''; print ''; print ''; // EMail print ''; // Web print ''; // Prof ids $i=1; $j=0; while ($i <= 6) { $idprof=$langs->transcountry('ProfId'.$i,$object->country_code); if ($idprof!='-') { if (($j % 2) == 0) print ''; print ''; if (($j % 2) == 1) print ''; $j++; } $i++; } if ($j % 2 == 1) print ''; // VAT payers $form = new Form($db); print ''; // VAT Code print ''; print ''; // Local Taxes // TODO add specific function by country if($mysoc->country_code=='ES') { if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { print ''; } elseif($mysoc->localtax1_assuj=="1") { print ''; } elseif($mysoc->localtax2_assuj=="1") { print ''; } } // Type + Staff $arr = $formcompany->typent_array(1); $object->typent= $arr[$object->typent_code]; print ''; // Legal print ''; // Capital print ''; // Default language if ($conf->global->MAIN_MULTILANGS) { require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); print ''; } // Other attributes $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); print '\n"; } } // Ban if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) { print ''; print ''; } // Parent company if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { print ''; print ''; } // Commercial print ''; print ''; // Module Adherent if ($conf->adherent->enabled) { $langs->load("members"); print ''; print ''; print "\n"; } print '
'.$langs->trans("Ref").''; print $fuser->id; print '
'.$langs->trans('ThirdPartyName').''; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'; if ($showlogo) $htmllogobar.=$form->showphoto('societe',$object,50); if ($showlogo && $showbarcode) $htmllogobar.='

'; if ($showbarcode) $htmllogobar.=$form->showbarcode($object,50); $htmllogobar.='
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
'; print $langs->trans('Gencod').''.$object->barcode; print '
'.$langs->trans("Status").''; print $object->getLibStatut(2); print '
".$langs->trans('Address').''; dol_print_address($object->address,'gmap','thirdparty',$object->id); print "
'.$langs->trans('Zip').' / '.$langs->trans("Town").''; print $object->zip.($object->zip && $object->town?" / ":"").$object->town; print "
'.$langs->trans("Country").''; $img=picto_from_langcode($object->country_code); if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); else print ($img?$img.' ':'').$object->country; print '
'.$langs->trans('State').''.$object->state.'
'.$langs->trans('Phone').''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
'.$langs->trans('EMail').''; print dol_print_email($object->email,0,$object->id,'AC_EMAIL'); print ''.$langs->trans('Web').''; print dol_print_url($object->url); print '
'.$idprof.''; $key='idprof'.$i; print $object->$key; if ($object->$key) { if ($object->id_prof_check($i,$object) > 0) print '   '.$object->id_prof_url($i,$object); else print ' ('.$langs->trans("ErrorWrongValue").')'; } print '
'; print $langs->trans('VATIsUsed'); print ''; print yn($object->tva_assuj); print ''.$langs->trans('VATIntra').''; if ($object->tva_intra) { $s=''; $s.=$object->tva_intra; $s.=''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { $s.='   '; if ($conf->use_javascript_ajax) { print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); } else { $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } } print $s; } else { print ' '; } print '
'.$langs->trans("LocalTax1IsUsedES").''; print yn($object->localtax1_assuj); print ''.$langs->trans("LocalTax2IsUsedES").''; print yn($object->localtax2_assuj); print '
'.$langs->trans("LocalTax1IsUsedES").''; print yn($object->localtax1_assuj); print '
'.$langs->trans("LocalTax2IsUsedES").''; print yn($object->localtax2_assuj); print '
'.$langs->trans("ThirdPartyType").''.$object->typent.''.$langs->trans("Staff").''.$object->effectif.'
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; if ($object->capital) print $object->capital.' '.$langs->trans("Currency".$conf->currency); else print ' '; print '
'.$langs->trans("DefaultLang").''; //$s=picto_from_langcode($object->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); $labellang = ($object->default_lang?$langs->trans('Language_'.$object->default_lang):''); print $labellang; print '
'.$label.''; print $extrafields->showOutputField($key,$value); print "
'; print '
'; print $langs->trans('RIB'); print ''; if ($user->rights->societe->creer) print ''.img_edit().''; else print ' '; print '
'; print '
'; print $object->display_rib(); print '
'; print '
'; print $langs->trans('ParentCompany'); print ''; if ($user->rights->societe->creer) print ''.img_edit() .''; else print ' '; print '
'; print '
'; if ($object->parent) { $socm = new Societe($db); $socm->fetch($object->parent); print $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); print $socm->town?' - '.$socm->town:''; } else { print $langs->trans("NoParentCompany"); } print '
'; print '
'; print $langs->trans('SalesRepresentatives'); print ''; if ($user->rights->societe->creer) print ''.img_edit().''; else print ' '; print '
'; print '
'; $listsalesrepresentatives=$object->getSalesRepresentatives($user); $nbofsalesrepresentative=count($listsalesrepresentatives); if ($nbofsalesrepresentative > 3) // We print only number { print ''; print $nbofsalesrepresentative; print ''; } else if ($nbofsalesrepresentative > 0) { $userstatic=new User($db); $i=0; foreach($listsalesrepresentatives as $val) { $userstatic->id=$val['id']; $userstatic->lastname=$val['name']; $userstatic->firstname=$val['firstname']; print $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) print ', '; } } else print $langs->trans("NoSalesRepresentativeAffected"); print '
'.$langs->trans("LinkedToDolibarrMember").''; $adh=new Adherent($db); $result=$adh->fetch('','',$object->id); if ($result > 0) { $adh->ref=$adh->getFullName($langs); print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '
'; dol_fiche_end(); /* * Actions */ print '
'."\n"; if ($user->rights->societe->creer) { print ''.$langs->trans("Modify").''."\n"; } if ($user->rights->societe->supprimer) { if ($conf->use_javascript_ajax) { print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } } print '
'."\n"; print '
'; if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) { print ''; print ''; print ''; print '
'; print ''; // ancre /* * Documents generes */ $filedir=$conf->societe->multidir_output[$object->entity].'/'.$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',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); print '
'; print '
'; } // Subsidiaries list $result=show_subsidiaries($conf,$langs,$db,$object); // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } // Addresses list if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) { $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } // Projects list $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } } // End of page llxFooter(); $db->close(); ?>