Qual: Removed 2 TODO

Qual: Removed deprecated function
Qual: Removed hard coded link
This commit is contained in:
Laurent Destailleur 2011-02-14 16:49:04 +00:00
parent 6d3269bb69
commit 588320321f
5 changed files with 100 additions and 92 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* 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 "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->rowid.'">';
print img_object($langs->trans("ShowCustomer"),"company");
print '</a>&nbsp;<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->rowid.'">'.stripslashes($obj->nom).'</a></td>';
print '<td>';
$thirdpartystatic->id=$obj->rowid;
$thirdpartystatic->nom=$obj->nom;
$thirdpartystatic->client=$obj->client;
$thirdpartystatic->canvas=$obj->canvas;
print $thirdpartystatic->getNomUrl(1);
print '</td>';
print '<td>'.$obj->ville.'</td>';
print '<td>'.$obj->code_client.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';

View File

@ -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 '<select class="flat" name="'.$htmlname.'">';
if ($showempty) print print '<option value="0">&nbsp</option>';
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) print print '<option value="0"></option>';
foreach($lesTypes as $key=>$value)
{
print '<option value="'.$key.'">'.$value.'</option>';
@ -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 = '<input type="text" name="'.$htmlname.'" size="'.($formlength+1).'" maxlength="'.$formlength.'" value="'.$selected.'">';
return $out;
}
}
?>

View File

@ -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.= '<script language="JavaScript" type="text/javascript">';
@ -122,7 +122,7 @@ class ActionsCardDefault extends ActionsCardCommon
for ($i=1; $i<=4; $i++)
{
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->pays_code);
$this->tpl['showprofid'.$i] = $this->object->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i]);
$this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->pays_code);
}
// Type
@ -139,7 +139,7 @@ class ActionsCardDefault extends ActionsCardCommon
if (empty($conf->global->MAIN_DISABLEVATCHECK))
{
$s.=' ';
if ($conf->use_javascript_ajax)
{
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
@ -179,7 +179,7 @@ class ActionsCardDefault extends ActionsCardCommon
if (empty($conf->global->MAIN_DISABLEVATCHECK))
{
$s.=' &nbsp; ';
if ($conf->use_javascript_ajax)
{
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
@ -194,7 +194,7 @@ class ActionsCardDefault extends ActionsCardCommon
{
$this->tpl['tva_intra'] = $s;
}
}
else
{
@ -215,7 +215,7 @@ class ActionsCardDefault extends ActionsCardCommon
}
}
}
/**
* Check permissions of a user to show a page and an object. Check read permission
* If $_REQUEST['action'] defined, we also check write permission.

View File

@ -102,9 +102,9 @@ class Societe extends CommonObject
var $mode_reglement; // TODO obsolete
var $cond_reglement; // TODO obsolete
var $client; // 0=no customer, 1=customer, 2=prospect
var $client; // 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
var $prospect; // 0=no prospect, 1=prospect
var $fournisseur; // =0no supplier, 1=supplier
var $fournisseur; // 0=no supplier, 1=supplier
var $prefixCustomerIsRequired;
var $prefixSupplierIsRequired;
@ -1338,34 +1338,39 @@ class Societe extends CommonObject
/**
* \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto Inclut le picto dans le lien (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul)
* \param option Sur quoi pointe le lien ('', 'customer', 'supplier', 'compta')
* \param maxlen Longueur max libelle
* \return string Chaine avec URL
* Return a link on thirdparty (with picto)
* @param withpicto Inclut le picto dans le lien (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul)
* @param option Sur quoi pointe le lien ('', 'customer', 'prospect', 'supplier')
* @param maxlen Max length of text
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='customer',$maxlen=0)
{
global $langs;
global $conf,$langs;
$result='';
$lien=$lienfin='';
if ($option == 'customer' || $option == 'compta')
{
if ($this->client == 1)
if ($this->client == 1 && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) // Only customer
{
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
}
elseif($this->client == 2)
elseif($this->client == 2 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) // Only prospect
{
$lien = '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id;
}
}
if ($option == 'supplier')
else if ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
$lien = '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id;
}
else if ($option == 'supplier')
{
$lien = '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$this->id;
}
// By default
if (empty($lien))
{
$lien = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id;
@ -1384,8 +1389,8 @@ class Societe extends CommonObject
/**
* \brief Return full address of a third party (TODO in format of its country)
* \return string Full address string
* Return full address of a third party (TODO in format of its country)
* @return string Full address string
*/
function getFullAddress()
{
@ -2149,55 +2154,6 @@ class Societe extends CommonObject
}
}
/**
* Retourne le formulaire de saisie d'un identifiant professionnel (siren, siret, etc...)
* @param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param htmlname Nom de la zone input
* @param preselected Default value to show
* TODO not in business class
*/
function show_input_id_prof($idprof,$htmlname,$preselected)
{
print $this->get_input_id_prof($idprof, $htmlname, $preselected);
}
/**
* Retourne le formulaire de saisie d'un identifiant professionnel (siren, siret, etc...)
* @param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param htmlname Nom de la zone input
* @param preselected Default value to show
* TODO not in business class
*/
function get_input_id_prof($idprof,$htmlname,$preselected)
{
global $conf,$langs;
$formlength=24;
if ($this->pays_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 ($this->pays_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 = '<input type="text" name="'.$htmlname.'" size="'.($formlength+1).'" maxlength="'.$formlength.'" value="'.$selected.'">';
return $out;
}
/**
* Cree en base un tiers depuis l'objet adherent

View File

@ -800,7 +800,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(1,'idprof1',$soc->siren);
print $formcompany->get_input_id_prof(1,'idprof1',$soc->siren,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -809,7 +809,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(2,'idprof2',$soc->siret);
print $formcompany->get_input_id_prof(2,'idprof2',$soc->siret,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -820,7 +820,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(3,'idprof3',$soc->ape);
print $formcompany->get_input_id_prof(3,'idprof3',$soc->ape,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -829,7 +829,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(4,'idprof4',$soc->idprof4);
print $formcompany->get_input_id_prof(4,'idprof4',$soc->idprof4,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -1213,7 +1213,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(1,'idprof1',$soc->siren);
print $formcompany->get_input_id_prof(1,'idprof1',$soc->siren,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -1222,7 +1222,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(2,'idprof2',$soc->siret);
print $formcompany->get_input_id_prof(2,'idprof2',$soc->siret,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -1233,7 +1233,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(3,'idprof3',$soc->ape);
print $formcompany->get_input_id_prof(3,'idprof3',$soc->ape,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';
@ -1242,7 +1242,7 @@ else
if ($idprof!='-')
{
print '<td>'.$idprof.'</td><td>';
$soc->show_input_id_prof(4,'idprof4',$soc->idprof4);
print $formcompany->get_input_id_prof(4,'idprof4',$soc->idprof4,$soc->pays_code);
print '</td>';
}
else print '<td>&nbsp;</td><td>&nbsp;</td>';