From 588320321f83f029068a091d24267371a7d5e4b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2011 16:49:04 +0000 Subject: [PATCH] Qual: Removed 2 TODO Qual: Removed deprecated function Qual: Removed hard coded link --- htdocs/comm/clients.php | 17 ++-- htdocs/core/class/html.formcompany.class.php | 63 +++++++++++++-- .../default/actions_card_default.class.php | 16 ++-- htdocs/societe/class/societe.class.php | 80 +++++-------------- htdocs/societe/soc.php | 16 ++-- 5 files changed, 100 insertions(+), 92 deletions(-) diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index fb387011006..eb166d0be56 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -57,12 +57,13 @@ $search_categ = isset($_GET["search_categ"])?$_GET["search_categ"]:$_POST["searc */ $htmlother=new FormOther($db); +$thirdpartystatic=new Societe($db); llxHeader(); -$sql = "SELECT s.rowid, s.nom, s.ville, st.libelle as stcomm, s.prefix_comm, s.code_client"; -$sql.= ",s.datec, s.datea"; +$sql = "SELECT s.rowid, s.nom, s.client, s.ville, st.libelle as stcomm, s.prefix_comm, s.code_client,"; +$sql.= " s.datec, s.datea, s.canvas"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We'll need these fields in order to filter by categ @@ -176,9 +177,13 @@ if ($result) $var=!$var; print ""; - print ''; - print img_object($langs->trans("ShowCustomer"),"company"); - print ' '.stripslashes($obj->nom).''; + print ''; + $thirdpartystatic->id=$obj->rowid; + $thirdpartystatic->nom=$obj->nom; + $thirdpartystatic->client=$obj->client; + $thirdpartystatic->canvas=$obj->canvas; + print $thirdpartystatic->getNomUrl(1); + print ''; print ''.$obj->ville.''; print ''.$obj->code_client.''; print ''.dol_print_date($db->jdate($obj->datec),'day').''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 8b87678a23b..ee29eef5340 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -597,15 +597,20 @@ class FormCompany } } - - /** - * - */ - function selectTypeContact($object, $defValue, $htmlname = 'type', $source, $order='code', $showempty=0) + /** + * Return a select list with types of contacts + * @param object Object to use to find type of contact + * @param $selected Default selected value + * @param htmlname + * @param source + * @param order + * @param showempty 1=Add en empty line + */ + function selectTypeContact($object, $selected, $htmlname = 'type', $source, $order='code', $showempty=0) { $lesTypes = $object->liste_type_contact($source, $order); - print ''; + if ($showempty) print print ''; foreach($lesTypes as $key=>$value) { print ''; @@ -614,7 +619,11 @@ class FormCompany } /** - * Retourne la liste deroulante des codes postaux et des villes associĆ©es + * Return a select list with zip codes and their town + * @param selected + * @param htmlname + * @param fields + * @param fieldsize */ function select_ziptown($selected='',$htmlname='zipcode',$fields='',$fieldsize=0) { @@ -631,6 +640,44 @@ class FormCompany return $out; } + /** + * Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...) + * @param idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) + * @param htmlname Name of HTML select + * @param preselected Default value to show + * @param country_code FR, IT, ... + */ + function get_input_id_prof($idprof,$htmlname,$preselected,$country_code) + { + global $conf,$langs; + + $formlength=24; + if ($country_code == 'FR' && empty($conf->global->MAIN_DISABLEPROFIDRULES)) + { + if ($idprof==1) $formlength=9; + if ($idprof==2) $formlength=14; + if ($idprof==3) $formlength=5; // 4 chiffres et 1 lettre depuis janvier + if ($idprof==4) $formlength=32; // No maximum as we need to include a town name in this id + } + if ($country_code == 'ES' && empty($conf->global->MAIN_DISABLEPROFIDRULES)) + { + if ($idprof==1) $formlength=9; //CIF/NIF/NIE 9 digits + if ($idprof==2) $formlength=12; //NASS 12 digits without / + if ($idprof==3) $formlength=5; //CNAE 5 digits + if ($idprof==4) $formlength=32; //depend of college + } + + $selected=$preselected; + if (! $selected && $idprof==1) $selected=$this->siren; + if (! $selected && $idprof==2) $selected=$this->siret; + if (! $selected && $idprof==3) $selected=$this->ape; + if (! $selected && $idprof==4) $selected=$this->idprof4; + + $out = ''; + + return $out; + } + } ?> diff --git a/htdocs/societe/canvas/default/actions_card_default.class.php b/htdocs/societe/canvas/default/actions_card_default.class.php index 9404d4ef6e0..e71b71cd094 100644 --- a/htdocs/societe/canvas/default/actions_card_default.class.php +++ b/htdocs/societe/canvas/default/actions_card_default.class.php @@ -59,7 +59,7 @@ class ActionsCardDefault extends ActionsCardCommon return $out; } - + /** * Return the head of card (tabs) */ @@ -67,7 +67,7 @@ class ActionsCardDefault extends ActionsCardCommon { $head = societe_prepare_head($this->object); $title = $this->getTitle($action); - + return dol_fiche_head($head, 'card', $title, 0, 'company'); } @@ -105,7 +105,7 @@ class ActionsCardDefault extends ActionsCardCommon $this->tpl['profid2'] = $this->object->siret; $this->tpl['profid3'] = $this->object->ape; $this->tpl['profid4'] = $this->object->idprof4; - + if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) { $js = "\n"; $js.= '