From 4ab16dd3a6059f95ed4a777ca735ab369636e3f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Nov 2008 19:20:24 +0000 Subject: [PATCH] Fix: Bad url link --- htdocs/lib/functions.lib.php | 33 +- htdocs/soc.php | 1151 +++++++++++++++++----------------- 2 files changed, 602 insertions(+), 582 deletions(-) diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 936f6b2b4d4..0e578d5de44 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -759,7 +759,7 @@ function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$nolinks=fals { $newphone=''.$newphone.''; } - $clicktodiallink=dol_phone_link($phone); + $clicktodiallink=dol_print_phone_link($phone); if ($clicktodiallink) { $newphone='
'.$newphone.' '.$clicktodiallink.'
'; @@ -783,13 +783,32 @@ function dol_print_size($size) } +/** + * \brief Show Url link + * \param url Url to show + * \param target Target for link + * \param max Max number of characters to show + * \return string HTML Link + */ +function dol_print_url($url,$target='_blank',$max=32) +{ + $link=''; + if (! eregi('^http',$url)) $link.='http://'; + $link.=dolibarr_trunc($url,$max); + $link.=''; + return $link; +} + /** * \brief Show click to dial link * \param phone Phone to call * \param option Type of picto * \return string Link */ -function dol_phone_link($phone,$option=0) +function dol_print_phone_link($phone,$option=0) { global $conf,$user; @@ -2604,20 +2623,22 @@ function clean_url($url,$http=1) $domain=$regs[2]; $port=$regs[3]; //print $url." -> ".$proto." - ".$domain." - ".$port; - $url = dol_string_nospecial(trim($url)); - + //$url = dol_string_nospecial(trim($url)); + $url = trim($url); + // Si http: defini on supprime le http (Si https on ne supprime pas) + $newproto=$proto; if ($http==0) { if (eregi('^http:[\\\/]+',$url)) { $url = eregi_replace('^http:[\\\/]+','',$url); - $proto = ''; + $newproto = ''; } } // On passe le nom de domaine en minuscule - $url = eregi_replace('^(https?:[\\\/]+)?'.$domain,$proto.strtolower($domain),$url); + $url = eregi_replace('^'.$proto.$domain, $newproto.strtolower($domain), $url); return $url; } diff --git a/htdocs/soc.php b/htdocs/soc.php index 8ad172d15a1..7b4024f3632 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -22,11 +22,11 @@ */ /** - \file htdocs/soc.php - \ingroup societe - \brief Third party card page - \version $Id$ -*/ + * \file htdocs/soc.php + * \ingroup societe + * \brief Third party card page + * \version $Id$ + */ require("pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); @@ -51,18 +51,18 @@ $soc = new Societe($db); if ($_POST["getcustomercode"]) { - // On défini valeur pour code_client - $_POST["code_client"]="aa"; + // On défini valeur pour code_client + $_POST["code_client"]="aa"; } if ($_POST["getsuppliercode"]) { - // On défini valeur pour code_fournisseur - $_POST["code_fournisseur"]="aa"; + // On défini valeur pour code_fournisseur + $_POST["code_fournisseur"]="aa"; } if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) - && ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer) +&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer) { $error=0; @@ -116,17 +116,17 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) $soc->client = $_POST["client"]; $soc->fournisseur = $_POST["fournisseur"]; $soc->fournisseur_categorie = $_POST["fournisseur_categorie"]; - + $soc->commercial_id = $_POST["commercial_id"]; - + if ($soc->fournisseur && ! $conf->fournisseur->enabled) { $error = 1; $soc->error = $langs->trans("ErrorSupplierModuleNotEnabled"); - $_GET["action"]= "create"; + $_GET["action"]= "create"; } - + if (! $error) { // On vérifie si un tiers devient client ou fournisseur pour l'obtention d'un code automatiqe @@ -138,7 +138,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) { $soc->code_client = ''; } - + if ($soc->fournisseur && $soc->code_fournisseur == -1) { $soc->code_fournisseur = -1; @@ -151,7 +151,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) if ($_POST["action"] == 'add') { $db->begin(); - + $result = $soc->create($user); if ($result >= 0) { @@ -159,27 +159,27 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) { dolibarr_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->adresse; - $contact->cp=$soc->cp; - $contact->ville=$soc->ville; - $contact->fk_pays=$soc->fk_pays; - $contact->socid=$soc->id; // fk_soc - $contact->status=1; - $contact->email=$soc->email; - $contact->priv=0; - + $contact->name=$soc->nom_particulier; + $contact->firstname=$soc->prenom; + $contact->address=$soc->adresse; + $contact->cp=$soc->cp; + $contact->ville=$soc->ville; + $contact->fk_pays=$soc->fk_pays; + $contact->socid=$soc->id; // fk_soc + $contact->status=1; + $contact->email=$soc->email; + $contact->priv=0; + $result=$contact->create($user); } } - + if ($result >= 0) { $db->commit(); - + if ( $soc->client == 1 ) { Header("Location: comm/fiche.php?socid=".$soc->id); @@ -217,10 +217,10 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) Header("Location: soc.php?socid=".$socid); exit; } - + $oldsoc=new Societe($db); $result=$oldsoc->fetch($socid); - + $result = $soc->update($socid,$user,1,$oldsoc->codeclient_modifiable(),$oldsoc->codefournisseur_modifiable()); if ($result >= 0) { @@ -231,7 +231,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) { $soc->id = $socid; $reload = 0; - + $mesg = $soc->error; $_GET["action"]= "edit"; } @@ -260,8 +260,8 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && /* -* View -*/ + * View + */ llxHeader(); @@ -270,11 +270,11 @@ $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("Se if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || - $_GET["action"] == 'create' || $_POST["action"] == 'create') +$_GET["action"] == 'create' || $_POST["action"] == 'create') { /* - * Fiche en mode creation - */ + * Fiche en mode creation + */ if ($user->rights->societe->creer) { // Charge objet modCodeTiers @@ -294,10 +294,10 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || } require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php"); $modCodeFournisseur = new $module; - + /* - * Fiche societe en mode création - */ + * Fiche societe en mode création + */ if ($_GET["type"]=='f') { $soc->fournisseur=1; } if ($_GET["type"]=='c') { $soc->client=1; } if ($_GET["type"]=='p') { $soc->client=2; } @@ -327,11 +327,11 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || $soc->idprof4=$_POST["idprof4"]; $soc->typent_id=($_POST["typent_id"]&&!$_POST["cleartype"])?$_POST["typent_id"]:($_REQUEST["private"]?'TE_PRIVATE':''); $soc->effectif_id=($_POST["effectif_id"]&&!$_POST["cleartype"])?$_POST["effectif_id_id"]:($_REQUEST["private"]?'EF1-5':''); - + $soc->tva_assuj = $_POST["assujtva_value"]; $soc->tva_intra_code=$_POST["tva_intra_code"]; $soc->tva_intra_num=$_POST["tva_intra_num"]; - + $soc->commercial_id=$_POST["commercial_id"]; // On positionne pays_id, pays_code et libelle du pays choisi @@ -351,7 +351,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || $soc->pays_code=$obj->code; $soc->pays=$obj->libelle; } - + print_titre($langs->trans("NewCompany")); if ($conf->use_javascript_ajax) @@ -365,35 +365,35 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || print ' '.$langs->trans("Individual"); - print ' ('.$langs->trans("ToCreateContactWithSameName").')'; + print ' ('.$langs->trans("ToCreateContactWithSameName").')'; print "
\n"; print "
\n"; } - + dol_htmloutput_errors($soc->error,$soc->errors); - + print '
'; - + print ''; print ''; print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; - + print ''; - + print ''; print ''; - + if ($soc->particulier) { print ''; print ''; - - print ''; - print ''; + + print ''; + print ''; } - + // Client / Prospect print ''; + print ''; } print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + + print ''; + print ''; - print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - // IdProf1 (SIREN pour France) - $idprof=$langs->transcountry('ProfId1',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - // IdProf2 (SIRET pour France) - $idprof=$langs->transcountry('ProfId2',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - print ''; - print ''; - // IdProf3 (APE pour France) - $idprof=$langs->transcountry('ProfId3',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - // IdProf4 (NU pour France) - $idprof=$langs->transcountry('ProfId4',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - print ''; + print ''; + // IdProf1 (SIREN pour France) + $idprof=$langs->transcountry('ProfId1',$soc->pays_code); + if ($idprof!='-') + { + print ''; + } + else print ''; + // IdProf2 (SIRET pour France) + $idprof=$langs->transcountry('ProfId2',$soc->pays_code); + if ($idprof!='-') + { + print ''; + } + else print ''; + print ''; + print ''; + // IdProf3 (APE pour France) + $idprof=$langs->transcountry('ProfId3',$soc->pays_code); + if ($idprof!='-') + { + print ''; + } + else print ''; + // IdProf4 (NU pour France) + $idprof=$langs->transcountry('ProfId4',$soc->pays_code); + if ($idprof!='-') + { + print ''; + } + else print ''; + print ''; // Assujeti TVA print ''; - print ''; + print ''; - print ''; + print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; + print ''; + print ''; - print '
'.$langs->trans('Name').''.$langs->trans('Prefix').'
'.$langs->trans('FirstName').' 
'.$langs->trans("UserTitle").''; - print $form->select_civilite($contact->civilite_id).' 
'.$langs->trans("UserTitle").''; + print $form->select_civilite($contact->civilite_id).' 
'.$langs->trans('ProspectCustomer').'
'.$langs->trans('Gencod').''; print $soc->gencod; - print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').'use_javascript_ajax && $conf->global->MAIN_AUTO_FILLTOWNFROMZIP) print ' onChange="autofilltownfromzip_PopupPostalCode(cp.value,ville)"'; - print '>'; - if ($conf->use_javascript_ajax && $conf->global->MAIN_AUTO_FILLTOWNFROMZIP) print ' '; - print '
'.$langs->trans('Address').'
'.$langs->trans('Town').'
'.$langs->trans('Zip').'use_javascript_ajax && $conf->global->MAIN_AUTO_FILLTOWNFROMZIP) print ' onChange="autofilltownfromzip_PopupPostalCode(cp.value,ville)"'; + print '>'; + if ($conf->use_javascript_ajax && $conf->global->MAIN_AUTO_FILLTOWNFROMZIP) print ' '; + print '
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id,'pays_id',$conf->use_javascript_ajax?' onChange="autofilltownfromzip_save_refresh_edit()"':''); + print ''.$langs->trans('Town').'
'.$langs->trans('Country').''; + $form->select_pays($soc->pays_id,'pays_id',$conf->use_javascript_ajax?' onChange="autofilltownfromzip_save_refresh_edit()"':''); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print '
'.$langs->trans('State').''; - $form->select_departement($soc->departement_id,$soc->pays_code); - print '
'.$langs->trans('State').''; + $form->select_departement($soc->departement_id,$soc->pays_code); + print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('EMail').''.$langs->trans('Web').'
'.$langs->trans('EMail').''.$langs->trans('Web').'
'.$idprof.''; - $soc->show_input_id_prof(1,'idprof1',$soc->siren); - print '  '.$idprof.''; - $soc->show_input_id_prof(2,'idprof2',$soc->siret); - print '  
'.$idprof.''; - $soc->show_input_id_prof(3,'idprof3',$soc->ape); - print '  '.$idprof.''; - $soc->show_input_id_prof(4,'idprof4',$soc->idprof4); - print '  
'.$idprof.''; + $soc->show_input_id_prof(1,'idprof1',$soc->siren); + print '  '.$idprof.''; + $soc->show_input_id_prof(2,'idprof2',$soc->siret); + print '  
'.$idprof.''; + $soc->show_input_id_prof(3,'idprof3',$soc->ape); + print '  '.$idprof.''; + $soc->show_input_id_prof(4,'idprof4',$soc->idprof4); + print '  
'.$langs->trans('VATIsUsed').''; @@ -900,118 +900,118 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') print ''; print "\n"; } - print ''.$langs->trans('VATIntra').''; - $s =''; - $s.=''; + print ''.$langs->trans('VATIntra').''; + $s =''; + $s.=''; $s.=' '; if ($conf->use_javascript_ajax) { $s.=''.$langs->trans("VATIntraCheck").''; - print $form->textwithhelp($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + print $form->textwithhelp($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); } else { print $s.'id_pays).'" target="_blank" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; } - print '
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('JuridicalStatus').''; - $form->select_forme_juridique($soc->forme_juridique_code,$soc->pays_code); - print '
'.$langs->trans('JuridicalStatus').''; + $form->select_forme_juridique($soc->forme_juridique_code,$soc->pays_code); + print '
'.$langs->trans("Type").''; - $form->select_array("typent_id",$form->typent_array(0), $soc->typent_id); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print ''.$langs->trans("Staff").''; - $form->select_array("effectif_id",$form->effectif_array(0), $soc->effectif_id); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print '
'.$langs->trans("Type").''; + $form->select_array("typent_id",$form->typent_array(0), $soc->typent_id); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + print ''.$langs->trans("Staff").''; + $form->select_array("effectif_id",$form->effectif_array(0), $soc->effectif_id); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + print '
'; - print ''; + print '
'; + print ''; print '   '; - print ''; - print '
'; - print '
'; - } + print ''; + print ''; + } } else { - /* - * Fiche société en mode visu - */ - $soc = new Societe($db); - $soc->id = $socid; - $result=$soc->fetch($socid); - if ($result < 0) - { - dolibarr_print_error($db,$soc->error); - exit; - } + /* + * Fiche société en mode visu + */ + $soc = new Societe($db); + $soc->id = $socid; + $result=$soc->fetch($socid); + if ($result < 0) + { + dolibarr_print_error($db,$soc->error); + exit; + } $head = societe_prepare_head($soc); - - dolibarr_fiche_head($head, 'company', $langs->trans("ThirdParty")); + + dolibarr_fiche_head($head, 'company', $langs->trans("ThirdParty")); - // Confirmation de la suppression de la facture - if ($_GET["action"] == 'delete') - { - $html = new Form($db); - $html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete"); - print "
\n"; - } + // Confirmation de la suppression de la facture + if ($_GET["action"] == 'delete') + { + $html = new Form($db); + $html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete"); + print "
\n"; + } - if ($mesg) - { - print '
'; - print $mesg; - print '
'; - } + if ($mesg) + { + print '
'; + print $mesg; + print '
'; + } print '
'; print ''; - // + // print ''; print ''; - print ''; + print ''; - if ($soc->client) { - print ''; - } + if ($soc->client) { + print ''; + } - if ($soc->fournisseur) { - print ''; - } + if ($soc->fournisseur) { + print ''; + } if ($conf->global->MAIN_MODULE_BARCODE) { - print ''; - } - - print ""; + print ''; + } - print '"; - print '"; + print ""; + + print '"; + print '"; // Country print ''; - print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - // ProfId1 (SIREN pour France) - $profid=$langs->transcountry('ProfId1',$soc->pays_code); - if ($profid!='-') - { - print ''; - } - else print ''; - // ProfId2 (SIRET pour France) - $profid=$langs->transcountry('ProfId2',$soc->pays_code); - if ($profid!='-') - { - print ''; - } - else print ''; + // ProfId1 (SIREN pour France) + $profid=$langs->transcountry('ProfId1',$soc->pays_code); + if ($profid!='-') + { + print ''; + } + else print ''; + // ProfId2 (SIRET pour France) + $profid=$langs->transcountry('ProfId2',$soc->pays_code); + if ($profid!='-') + { + print ''; + } + else print ''; - // ProfId3 (APE pour France) - $profid=$langs->transcountry('ProfId3',$soc->pays_code); - if ($profid!='-') - { - print ''; - } - else print ''; - // ProfId4 (NU pour France) - $profid=$langs->transcountry('ProfId4',$soc->pays_code); - if ($profid!='-') - { - print ''; - } - else print ''; + // ProfId3 (APE pour France) + $profid=$langs->transcountry('ProfId3',$soc->pays_code); + if ($profid!='-') + { + print ''; + } + else print ''; + // ProfId4 (NU pour France) + $profid=$langs->transcountry('ProfId4',$soc->pays_code); + if ($profid!='-') + { + print ''; + } + else print ''; // Assujeti TVA $html = new Form($db); @@ -1110,8 +1109,8 @@ else print ''; print "\n"; } - print ''; - + print ''; + print ''; - // Capital - print ''; + // Capital + print ''; - // Statut juridique - print ''; + // Statut juridique + print ''; - // Type + Staff - $arr = $form->typent_array(1); - $soc->typent= $arr[$soc->typent_code]; - print ''; + // Type + Staff + $arr = $form->typent_array(1); + $soc->typent= $arr[$soc->typent_code]; + print ''; - // RIB - print ''; - print ''; + // RIB + print ''; + print ''; - // Maison mère - print ''; - print ''; + // Maison mère + print ''; + print ''; - // Commerciaux - print ''; - print ''; + print ''; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $obj = $db->fetch_object($resql); + print $obj->nb?($obj->nb):$langs->trans("NoSalesRepresentativeAffected"); + } + else { + dolibarr_print_error($db); + } + print ''; - print '
'.$langs->trans('Name').''; print $form->showrefnav($soc,'socid','',1,'rowid','nom'); print '
'.$langs->trans('Prefix').''.$soc->prefix_comm.'
'.$langs->trans('Prefix').''.$soc->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; + print $langs->trans('CustomerCode').''; + print $soc->code_client; + if ($soc->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 '
'; + print $langs->trans('SupplierCode').''; + print $soc->code_fournisseur; + if ($soc->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print '
'.$langs->trans('Gencod').''.$soc->gencod.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
'.$langs->trans('Gencod').''.$soc->gencod.'
'.$langs->trans('Zip').''.$soc->cp."'.$langs->trans('Town').''.$soc->ville."
".$langs->trans('Address')."".nl2br($soc->adresse)."
'.$langs->trans('Zip').''.$soc->cp."'.$langs->trans('Town').''.$soc->ville."
'.$langs->trans("Country").''; @@ -1019,77 +1019,76 @@ else else print $soc->pays; print '
'.$langs->trans('State').''.$soc->departement.'
'.$langs->trans('State').''.$soc->departement.'
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'
'.$langs->trans('EMail').''; - if ($soc->email) { print ''.$soc->email.''; } - else print ' '; - print ''.$langs->trans('Web').''; - if ($soc->url) { print 'http://'.dolibarr_trunc($soc->url,32).''; } - else print ' '; - print '
'.$langs->trans('EMail').''; + if ($soc->email) { print ''.$soc->email.''; } + else print ' '; + print ''.$langs->trans('Web').''; + print dol_print_url($soc->url); + print '
'.$profid.''; - print $soc->siren; - if ($soc->siren) - { - if ($soc->id_prof_check(1,$soc) > 0) print '   '.$soc->id_prof_url(1,$soc); - else print ' ('.$langs->trans("ErrorWrongValue").')'; - } - print '
  '.$profid.''; - print $soc->siret; - if ($soc->siret) - { - if ($soc->id_prof_check(2,$soc) > 0) print '   '.$soc->id_prof_url(2,$soc); - else print ' ('.$langs->trans("ErrorWrongValue").')'; - } - print '
  
'.$profid.''; + print $soc->siren; + if ($soc->siren) + { + if ($soc->id_prof_check(1,$soc) > 0) print '   '.$soc->id_prof_url(1,$soc); + else print ' ('.$langs->trans("ErrorWrongValue").')'; + } + print '
  '.$profid.''; + print $soc->siret; + if ($soc->siret) + { + if ($soc->id_prof_check(2,$soc) > 0) print '   '.$soc->id_prof_url(2,$soc); + else print ' ('.$langs->trans("ErrorWrongValue").')'; + } + print '
  
'.$profid.''; - print $soc->ape; - if ($soc->ape) - { - if ($soc->id_prof_check(3,$soc) > 0) print '   '.$soc->id_prof_url(3,$soc); - else print ' ('.$langs->trans("ErrorWrongValue").')'; - } - print '
  '.$profid.''; - print $soc->idprof4; - if ($soc->idprof4) - { - if ($soc->id_prof_check(4,$soc) > 0) print '   '.$soc->id_prof_url(4,$soc); - else print ' ('.$langs->trans("ErrorWrongValue").')'; - } - print '
  
'.$profid.''; + print $soc->ape; + if ($soc->ape) + { + if ($soc->id_prof_check(3,$soc) > 0) print '   '.$soc->id_prof_url(3,$soc); + else print ' ('.$langs->trans("ErrorWrongValue").')'; + } + print '
  '.$profid.''; + print $soc->idprof4; + if ($soc->idprof4) + { + if ($soc->id_prof_check(4,$soc) > 0) print '   '.$soc->id_prof_url(4,$soc); + else print ' ('.$langs->trans("ErrorWrongValue").')'; + } + print '
  
'.$langs->trans('VATIntra').''; - if ($soc->tva_intra) + print ''.$langs->trans('VATIntra').''; + if ($soc->tva_intra) { $s=''; $code=substr($soc->tva_intra,0,2); @@ -1134,140 +1133,140 @@ else { print ' '; } - print '
'.$langs->trans('Capital').''; - if ($soc->capital) print $soc->capital.' '.$langs->trans("Currency".$conf->monnaie); - else print ' '; - print '
'.$langs->trans('Capital').''; + if ($soc->capital) print $soc->capital.' '.$langs->trans("Currency".$conf->monnaie); + else print ' '; + print '
'.$langs->trans('JuridicalStatus').''.$soc->forme_juridique.'
'.$langs->trans('JuridicalStatus').''.$soc->forme_juridique.'
'.$langs->trans("Type").''.$soc->typent.''.$langs->trans("Staff").''.$soc->effectif.'
'.$langs->trans("Type").''.$soc->typent.''.$langs->trans("Staff").''.$soc->effectif.'
'; - print '
'; - print $langs->trans('RIB'); - print ''; - if ($user->rights->societe->creer) - print ''.img_edit().''; - else - print ' '; - print '
'; - print '
'; - print $soc->display_rib(); - print '
'; + print '
'; + print $langs->trans('RIB'); + print ''; + if ($user->rights->societe->creer) + print ''.img_edit().''; + else + print ' '; + print '
'; + print '
'; + print $soc->display_rib(); + print '
'; - print '
'; - print $langs->trans('ParentCompany'); - print ''; - if ($user->rights->societe->creer) - print ''.img_edit() .''; - else - print ' '; - print '
'; - print '
'; - if ($soc->parent) - { - $socm = new Societe($db); - $socm->fetch($soc->parent); - print ''.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.''.($socm->code_client?"(".$socm->code_client.")":"").' - '.$socm->ville; - } - else { - print $langs->trans("NoParentCompany"); - } - print '
'; + print '
'; + print $langs->trans('ParentCompany'); + print ''; + if ($user->rights->societe->creer) + print ''.img_edit() .''; + else + print ' '; + print '
'; + print '
'; + if ($soc->parent) + { + $socm = new Societe($db); + $socm->fetch($soc->parent); + print ''.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.''.($socm->code_client?"(".$socm->code_client.")":"").' - '.$socm->ville; + } + else { + print $langs->trans("NoParentCompany"); + } + print '
'; - print '
'; - print $langs->trans('SalesRepresentatives'); - print ''; - if ($user->rights->societe->creer) - print ''.img_edit().''; - else - print ' '; - print '
'; - print '
'; + // Commerciaux + print '
'; + print '
'; + print $langs->trans('SalesRepresentatives'); + print ''; + if ($user->rights->societe->creer) + print ''.img_edit().''; + else + print ' '; + print '
'; + print '
'; - $sql = "SELECT count(sc.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE sc.fk_soc =".$soc->id; + $sql = "SELECT count(sc.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE sc.fk_soc =".$soc->id; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $obj = $db->fetch_object($resql); - print $obj->nb?($obj->nb):$langs->trans("NoSalesRepresentativeAffected"); - } - else { - dolibarr_print_error($db); - } - print '
'; + print ''; print '
'; - print "\n"; + print "\n"; - /* - * Actions - */ - if ($_GET["action"] == '') - { - print '
'; - - if ($user->rights->societe->creer) - { - print ''.$langs->trans("Modify").''; - } - - if ($conf->projet->enabled && $user->rights->projet->creer) - { - $langs->load("projects"); - print ''.$langs->trans("AddProject").''; - } - - if ($user->rights->societe->contact->creer) - { - print ''.$langs->trans("AddContact").''; - } - - if ($user->rights->societe->supprimer) - { - print 'use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=confirm_delete&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteCompany').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=delete"'; - } - print '>'.$langs->trans('Delete').''; - } - - print '
'; - print '
'; - } - /* - * Liste des contacts - */ + * Actions + */ + if ($_GET["action"] == '') + { + print '
'; + + if ($user->rights->societe->creer) + { + print ''.$langs->trans("Modify").''; + } + + if ($conf->projet->enabled && $user->rights->projet->creer) + { + $langs->load("projects"); + print ''.$langs->trans("AddProject").''; + } + + if ($user->rights->societe->contact->creer) + { + print ''.$langs->trans("AddContact").''; + } + + if ($user->rights->societe->supprimer) + { + print 'use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) + { + $url = $_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=confirm_delete&confirm=yes'; + print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteCompany').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"'; + } + else + { + print 'href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=delete"'; + } + print '>'.$langs->trans('Delete').''; + } + + print '
'; + print '
'; + } + + /* + * Liste des contacts + */ show_contacts($conf,$langs,$db,$soc); }