Works on contact canvas in relation to the thirdparty canvas module

This commit is contained in:
Regis Houssin 2010-11-03 11:39:40 +00:00
parent 23fed3b53f
commit ab53d438ce
12 changed files with 1438 additions and 905 deletions

View File

@ -55,8 +55,8 @@ class ActionsContactCardCommon
*/ */
function assign_values($action='') function assign_values($action='')
{ {
global $conf, $langs, $user, $mysoc, $canvas; global $conf, $langs, $user, $canvas;
global $form, $formadmin, $formcompany; global $form, $formcompany, $objsoc;
foreach($this->object as $key => $value) foreach($this->object as $key => $value)
{ {
@ -65,183 +65,147 @@ class ActionsContactCardCommon
if ($action == 'create' || $action == 'edit') if ($action == 'create' || $action == 'edit')
{ {
// Load object modCodeClient if ($conf->use_javascript_ajax)
$module=$conf->global->SOCIETE_CODECLIENT_ADDON; {
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined")); $this->tpl['ajax_selectpays'] = "\n".'<script type="text/javascript" language="javascript">
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') jQuery(document).ready(function () {
{ jQuery("#selectpays_id").change(function() {
$module = substr($module, 0, dol_strlen($module)-4); document.formsoc.action.value="'.$action.'";
} document.formsoc.submit();
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php"); });
$modCodeClient = new $module; })
$this->tpl['auto_customercode'] = $modCodeClient->code_auto; </script>'."\n";
// We verified if the tag prefix is used }
if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
if (is_object($objsoc) && $objsoc->id > 0)
// Load object modCodeFournisseur {
$module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON; $this->tpl['company'] = $objsoc->getNomUrl(1);
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON; $this->tpl['company_id'] = $objsoc->id;
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') }
{ else
$module = substr($module, 0, dol_strlen($module)-4); {
} $this->tpl['company'] = $form->select_company($this->object->socid,'socid','',1);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php"); }
$modCodeFournisseur = new $module;
$this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; // Civility
// We verified if the tag prefix is used $this->tpl[select_civility] = $formcompany->select_civility($this->object->civilite_id);
if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
// Predefined with third party
// TODO create a function if ($objsoc->typent_code == 'TE_PRIVATE')
$this->tpl['select_customertype'] = '<select class="flat" name="client">'; {
$this->tpl['select_customertype'].= '<option value="2"'.($this->object->client==2?' selected="selected"':'').'>'.$langs->trans('Prospect').'</option>'; if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
$this->tpl['select_customertype'].= '<option value="3"'.($this->object->client==3?' selected="selected"':'').'>'.$langs->trans('ProspectCustomer').'</option>'; if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->cp;
$this->tpl['select_customertype'].= '<option value="1"'.($this->object->client==1?' selected="selected"':'').'>'.$langs->trans('Customer').'</option>'; if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->ville;
$this->tpl['select_customertype'].= '<option value="0"'.($this->object->client==0?' selected="selected"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>'; if (dol_strlen(trim($this->object->phone_pro)) == 0) $this->object->phone_pro = $objsoc->tel;
$this->tpl['select_customertype'].= '</select>'; if (dol_strlen(trim($this->object->fax)) == 0) $this->object->fax = $objsoc->fax;
if (dol_strlen(trim($this->object->email)) == 0) $this->object->email = $objsoc->email;
// Customer }
$this->tpl['customercode'] = $this->object->code_client;
if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0);
$this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable();
$s=$modCodeClient->getToolTip($langs,$this->object,0);
$this->tpl['help_customercode'] = $form->textwithpicto('',$s,1);
// Supplier
$this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1);
$this->tpl['suppliercode'] = $this->object->code_fournisseur;
if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1);
$this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable();
$s=$modCodeFournisseur->getToolTip($langs,$this->object,1);
$this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1);
$this->object->LoadSupplierCateg();
$this->tpl['suppliercategory'] = $this->object->SupplierCategories;
$this->tpl['select_suppliercategory'] = $form->selectarray("fournisseur_categorie",$this->object->SupplierCategories,$_POST["fournisseur_categorie"],1);
// Zip // Zip
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->cp,'zipcode',array('town','selectpays_id','departement_id'),6); $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->cp,'zipcode',array('town','selectpays_id','departement_id'),6);
// Town // Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->ville,'town',array('zipcode','selectpays_id','departement_id')); $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->ville,'town',array('zipcode','selectpays_id','departement_id'));
if (dol_strlen(trim($this->object->fk_pays)) == 0) $this->object->fk_pays = $objsoc->pays_id;
// Country // Country
$this->tpl['select_country'] = $form->select_country($this->object->pays_id,'pays_id'); $this->tpl['select_country'] = $form->select_country($this->object->fk_pays,'pays_id');
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State // State
if ($this->object->pays_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->departement_id,$this->object->pays_code); if ($this->object->fk_pays) $this->tpl['select_state'] = $formcompany->select_state($this->object->departement_id,$this->object->pays_code);
else $this->tpl['select_state'] = $countrynotdefined; else $this->tpl['select_state'] = $countrynotdefined;
// Language // Public or private
if ($conf->global->MAIN_MULTILANGS) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
$this->tpl['select_visibility'] = $form->selectarray('priv',$selectarray,$this->object->priv,0);
// VAT }
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation
if ($action == 'view' || $action == 'edit')
// Select users {
$this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id,'commercial_id',1); // Emailing
if ($conf->mailing->enabled)
// Local Tax {
// TODO mettre dans une classe propre au pays $langs->load("mails");
if($mysoc->pays_code=='ES') $this->tpl['nb_emailing'] = $object->getNbOfEMailings();
{ }
$this->tpl['localtax'] = '';
// Linked element
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") $this->tpl['contact_element'] = array();
{ $i=0;
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); $this->object->load_ref_elements();
$this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); if ($conf->commande->enabled)
$this->tpl['localtax'].= '</td></tr>'; {
} $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForOrders");
elseif($mysoc->localtax1_assuj=="1") $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_commande?$this->object->ref_commande:$langs->trans("NoContactForAnyOrder");
{ $i++;
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; }
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); if ($conf->propal->enabled)
$this->tpl['localtax'].= '</td><tr>'; {
} $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForProposals");
elseif($mysoc->localtax2_assuj=="1") $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_propal?$this->object->ref_propal:$langs->trans("NoContactForAnyProposal");
{ $i++;
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; }
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); if ($conf->contrat->enabled)
$this->tpl['localtax'].= '</td><tr>'; {
} $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForContracts");
} $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_contrat?$this->object->ref_contrat:$langs->trans("NoContactForAnyContract");
$i++;
}
if ($conf->facture->enabled)
{
$this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForInvoices");
$this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_facturation?$this->object->ref_facturation:$langs->trans("NoContactForAnyInvoice");
$i++;
}
// Dolibarr user
if ($this->object->user_id)
{
$dolibarr_user=new User($this->db);
$result=$dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
}
else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
} }
if ($action == 'view') if ($action == 'view')
{ {
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom'); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'id');
if (is_object($objsoc) && $this->object->socid > 0)
{
$objsoc->fetch($this->object->socid);
$this->tpl['company'] = $objsoc->getNomUrl(1);
}
else
{
$this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany");
}
$this->tpl['civility'] = $this->object->getCivilityLabel();
$this->tpl['checkcustomercode'] = $this->object->check_codeclient(); $this->tpl['address'] = dol_nl2br($this->object->address);
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
$this->tpl['address'] = dol_nl2br($this->object->address); $this->tpl['zip'] = ($this->object->cp?$this->object->cp.'&nbsp;':'');
$img=picto_from_langcode($this->pays_code); $img=picto_from_langcode($this->pays_code);
if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->pays,$langs->trans("CountryIsInEEC"),1,0);
$this->tpl['country'] = ($img?$img.' ':'').$this->pays; $this->tpl['country'] = ($img?$img.' ':'').$this->pays;
$this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->pays_code,0,$this->object->id,'AC_TEL'); $this->tpl['phone_pro'] = dol_print_phone($this->object->phone_pro,$this->object->pays_code,0,$this->object->id,'AC_TEL');
$this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso,$this->object->pays_code,0,$this->object->id,'AC_TEL');
$this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile,$this->object->pays_code,0,$this->object->id,'AC_TEL');
$this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->pays_code,0,$this->object->id,'AC_FAX'); $this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->pays_code,0,$this->object->id,'AC_FAX');
$this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL'); $this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL');
$this->tpl['url'] = dol_print_url($this->object->url);
$this->tpl['visibility'] = $this->object->LibPubPriv($this->object->priv);
$this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
$this->tpl['note'] = nl2br($this->object->note);
// Third party type
$arr = $formcompany->typent_array(1);
$this->tpl['typent'] = $arr[$this->object->typent_code];
if ($conf->global->MAIN_MULTILANGS)
{
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
//$s=picto_from_langcode($this->default_lang);
//print ($s?$s.' ':'');
$langs->load("languages");
$this->tpl['default_lang'] = ($this->default_lang?$langs->trans('Language_'.$this->object->default_lang):'');
}
$this->tpl['image_edit'] = img_edit();
$this->tpl['display_rib'] = $this->object->display_rib();
// Sales representatives
// TODO move in business class
$sql = "SELECT count(sc.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sc.fk_soc =".$this->object->id;
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$obj = $this->db->fetch_object($resql);
$this->tpl['sales_representatives'] = $obj->nb?($obj->nb):$langs->trans("NoSalesRepresentativeAffected");
}
else
{
dol_print_error($this->db);
}
// Linked member
if ($conf->adherent->enabled)
{
$langs->load("members");
$adh=new Adherent($this->db);
$result=$adh->fetch('','',$this->object->id);
if ($result > 0)
{
$adh->ref=$adh->getFullName($langs);
$this->tpl['linked_member'] = $adh->getNomUrl(1);
}
else
{
$this->tpl['linked_member'] = $langs->trans("UserNotLinkedToMember");
}
}
} }
} }
@ -252,47 +216,34 @@ class ActionsContactCardCommon
{ {
global $langs, $mysoc; global $langs, $mysoc;
$this->object->id = $_POST["socid"]; $this->object->old_name = $_POST["old_name"];
$this->object->nom = $_POST["nom"]; $this->object->old_firstname = $_POST["old_firstname"];
$this->object->prefix_comm = $_POST["prefix_comm"];
$this->object->client = $_POST["client"]; $this->object->socid = $_POST["socid"];
$this->object->code_client = $_POST["code_client"]; $this->object->name = $_POST["name"];
$this->object->fournisseur = $_POST["fournisseur"]; $this->object->firstname = $_POST["firstname"];
$this->object->code_fournisseur = $_POST["code_fournisseur"]; $this->object->civilite_id = $_POST["civilite_id"];
$this->object->adresse = $_POST["adresse"]; // TODO obsolete $this->object->poste = $_POST["poste"];
$this->object->address = $_POST["adresse"]; $this->object->address = $_POST["address"];
$this->object->cp = $_POST["cp"]; $this->object->cp = $_POST["cp"];
$this->object->ville = $_POST["ville"]; $this->object->ville = $_POST["ville"];
$this->object->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; $this->object->fk_pays = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$this->object->departement_id = $_POST["departement_id"]; $this->object->fk_departement = $_POST["departement_id"];
$this->object->tel = $_POST["tel"]; $this->object->phone_pro = $_POST["phone_pro"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->fax = $_POST["fax"]; $this->object->fax = $_POST["fax"];
$this->object->email = $_POST["email"]; $this->object->email = $_POST["email"];
$this->object->url = $_POST["url"]; $this->object->jabberid = $_POST["jabberid"];
$this->object->capital = $_POST["capital"]; $this->object->priv = $_POST["priv"];
$this->object->siren = $_POST["idprof1"]; $this->object->note = $_POST["note"];
$this->object->siret = $_POST["idprof2"];
$this->object->ape = $_POST["idprof3"];
$this->object->idprof4 = $_POST["idprof4"];
$this->object->typent_id = $_POST["typent_id"];
$this->object->effectif_id = $_POST["effectif_id"];
$this->object->gencod = $_POST["gencod"];
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
$this->object->default_lang = $_POST["default_lang"];
$this->object->commercial_id = $_POST["commercial_id"];
$this->object->tva_assuj = $_POST["assujtva_value"]?$_POST["assujtva_value"]:1;
$this->object->tva_intra = $_POST["tva_intra"];
//Local Taxes
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
// We set pays_id, and pays_code label of the chosen country // We set pays_id, and pays_code label of the chosen country
// TODO move in business class // TODO move in business class
if ($this->object->pays_id) if ($this->object->fk_pays)
{ {
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->pays_id; $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->fk_pays;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -310,11 +261,109 @@ class ActionsContactCardCommon
/** /**
* Load data control * Load data control
*/ */
function doActions($socid) function doActions($id)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
// Creation utilisateur depuis contact
if (GETPOST("action") == 'confirm_create_user' && GETPOST("confirm") == 'yes' && $user->rights->user->user->creer)
{
// Recuperation contact actuel
$result = $this->object->fetch($id);
if ($result > 0)
{
// Creation user
$nuser = new User($this->db);
$result=$nuser->create_from_contact($this->object,$_POST["login"]);
if ($result < 0)
{
$msg=$nuser->error;
}
}
else
{
$msg=$object->error;
}
}
// Creation contact
if ($_POST["action"] == 'add' && $user->rights->societe->contact->creer)
{
$this->assign_post();
if (! $_POST["name"])
{
array_push($errors,$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")));
$_GET["action"] = $_POST["action"] = 'create';
}
if ($_POST["name"])
{
$id = $this->object->create($user);
if ($id > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
{
$errors=array($this->object->error);
$_GET["action"] = $_POST["action"] = 'create';
}
}
}
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes' && $user->rights->societe->contact->supprimer)
{
$result=$this->object->fetch($id);
$this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"];
$result = $this->object->delete();
if ($result > 0)
{
Header("Location: index.php");
exit;
}
else
{
$mesg=$this->object->error;
}
}
if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
{
if (empty($_POST["name"]))
{
$errors=array($langs->trans("ErrorFieldRequired",$langs->transnoentities("Name").' / '.$langs->transnoentities("Label")));
$error++;
$_GET["action"] = $_POST["action"] = 'edit';
}
if (! sizeof($errors))
{
$this->object->fetch($_POST["contactid"]);
$this->object->oldcopy=dol_clone($this->object);
$this->assign_post();
$result = $this->object->update($_POST["contactid"], $user);
if ($result > 0)
{
$this->object->old_name='';
$this->object->old_firstname='';
}
else
{
$mesg=$this->object->error;
}
}
}
} }
} }

View File

@ -53,9 +53,8 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$out=''; $out='';
if ($action == 'view') $out.= $langs->trans("ThirdParty"); if ($action == 'view' || $action == 'edit') $out.= $langs->trans("Contact");
if ($action == 'edit') $out.= $langs->trans("EditCompany"); if ($action == 'create') $out.= $langs->trans("AddContact");
if ($action == 'create') $out.= $langs->trans("NewCompany");
return $out; return $out;
} }
@ -72,9 +71,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* Execute actions * Execute actions
* @param Id of object (may be empty for creation) * @param Id of object (may be empty for creation)
*/ */
function doActions($socid) function doActions($id)
{ {
$return = parent::doActions($socid); $return = parent::doActions($id);
return $return; return $return;
} }

View File

@ -21,6 +21,101 @@
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->
<?php echo $this->tpl['ajax_selectpays']; ?>
<br>
<form method="post" name="formsoc" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="add">
<?php if ($this->control->tpl['company_id']) { ?>
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>">
<?php } ?>
<table class="border" width="100%">
<tr>
<td width="15%" class="fieldrequired"><?php echo $langs->trans("Lastname").' / '.$langs->trans("Label"); ?></td>
<td><input name="name" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['name']; ?>"></td>
<td width="20%"><?php echo $langs->trans("Firstname"); ?></td>
<td width="25%"><input name="firstname" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['firstname']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Company"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
</tr>
<tr>
<td width="15%"><?php echo $langs->trans("UserTitle"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_civility']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PostOrFunction"); ?></td>
<td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['poste']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Address"); ?></td>
<td colspan="3"><textarea class="flat" name="address" cols="70"><?php echo $this->control->tpl['address']; ?></textarea></td>
</tr>
<tr>
<td><?php echo $langs->trans("Zip").' / '.$langs->trans("Town"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_zip'].'&nbsp;'.$this->control->tpl['select_town']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Country"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_country'].$this->control->tpl['info_admin']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PhonePro"); ?></td>
<td><input name="phone_pro" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_pro']; ?>"></td>
<td><?php echo $langs->trans("PhonePerso"); ?></td>
<td><input name="phone_perso" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_perso']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("PhoneMobile"); ?></td>
<td><input name="phone_mobile" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_mobile']; ?>"></td>
<td><?php echo $langs->trans("Fax"); ?></td>
<td><input name="fax" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['fax']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Email"); ?></td>
<td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['email']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Jabberid"); ?></td>
<td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['jabberid']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_civility']; ?></td>
</tr>
<tr>
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
</tr>
<tr>
<td align="center" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></td>
</tr>
</table><br>
</form>
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE -->

View File

@ -21,6 +21,131 @@
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->
<?php echo $this->tpl['ajax_selectpays']; ?>
<br>
<form method="post" name="formsoc" action="<?php echo $_SERVER["PHP_SELF"].'?id='.GETPOST("id"); ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="id" value="<?php echo GETPOST("id"); ?>">
<input type="hidden" name="action" value="update">
<input type="hidden" name="contactid" value="<?php echo $object->id; ?>">
<input type="hidden" name="old_name" value="<?php echo $object->name; ?>">
<input type="hidden" name="old_firstname" value="<?php echo $object->firstname; ?>">
<?php if ($this->control->tpl['company_id']) { ?>
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>">
<?php } ?>
<table class="border" width="100%">
<tr>
<td><?php echo $langs->trans("Ref"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['ref']; ?></td>
</tr>
<tr>
<td width="15%" class="fieldrequired"><?php echo $langs->trans("Lastname").' / '.$langs->trans("Label"); ?></td>
<td><input name="name" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['name']; ?>"></td>
<td width="20%"><?php echo $langs->trans("Firstname"); ?></td>
<td width="25%"><input name="firstname" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['firstname']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Company"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
</tr>
<tr>
<td width="15%"><?php echo $langs->trans("UserTitle"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_civility']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PostOrFunction"); ?></td>
<td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['poste']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Address"); ?></td>
<td colspan="3"><textarea class="flat" name="address" cols="70"><?php echo $this->control->tpl['address']; ?></textarea></td>
</tr>
<tr>
<td><?php echo $langs->trans("Zip").' / '.$langs->trans("Town"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_zip'].'&nbsp;'.$this->control->tpl['select_town']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Country"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_country'].$this->control->tpl['info_admin']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PhonePro"); ?></td>
<td><input name="phone_pro" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_pro']; ?>"></td>
<td><?php echo $langs->trans("PhonePerso"); ?></td>
<td><input name="phone_perso" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_perso']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("PhoneMobile"); ?></td>
<td><input name="phone_mobile" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_mobile']; ?>"></td>
<td><?php echo $langs->trans("Fax"); ?></td>
<td><input name="fax" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['fax']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Email"); ?></td>
<td><input name="email" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['email']; ?>"></td>
<?php if ($this->control->tpl['nb_emailing']) { ?>
<td nowrap><?php echo $langs->trans("NbOfEMailingsReceived"); ?></td>
<td><?php echo $this->control->tpl['nb_emailing']; ?></td>
<?php } else { ?>
<td colspan="2">&nbsp;</td>
<?php } ?>
</tr>
<tr>
<td><?php echo $langs->trans("Jabberid"); ?></td>
<td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['jabberid']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_visibility']; ?></td>
</tr>
<tr>
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
</tr>
<?php foreach ($this->control->tpl['contact_element'] as $element) { ?>
<tr>
<td><?php echo $element['linked_element_label']; ?></td>
<td colspan="3"><?php echo $element['linked_element_value']; ?></td>
</tr>
<?php } ?>
<tr>
<td><?php echo $langs->trans("DolibarrLogin"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['dolibarr_user']; ?></td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>">&nbsp;
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
</tr>
</table><br>
</form>
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE -->

View File

@ -21,6 +21,109 @@
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->
<table class="border" width="100%">
<tr>
<td width="20%"><?php echo $langs->trans("Ref"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td>
</tr>
<tr>
<td width="20%"><?php echo $langs->trans("Lastname"); ?></td>
<td width="30%"><?php echo $this->control->tpl['name']; ?></td>
<td width="25%"><?php echo $langs->trans("Firstname"); ?></td>
<td width="25%"><?php echo $this->control->tpl['firstname']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Company"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
</tr>
<tr>
<td width="15%"><?php echo $langs->trans("UserTitle"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['civility']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PostOrFunction" ); ?></td>
<td colspan="3"><?php echo $this->control->tpl['poste']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Address"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['address']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Zip").' / '.$langs->trans("Town"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['zip'].$this->control->tpl['ville']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Country"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['country']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->control->tpl['departement']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PhonePro"); ?></td>
<td><?php echo $this->control->tpl['phone_pro']; ?></td>
<td><?php echo $langs->trans("PhonePerso"); ?></td>
<td><?php echo $this->control->tpl['phone_perso']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("PhoneMobile"); ?></td>
<td><?php echo $this->control->tpl['phone_mobile']; ?></td>
<td><?php echo $langs->trans("Fax"); ?></td>
<td><?php echo $this->control->tpl['fax']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("EMail"); ?></td>
<td><?php echo $this->control->tpl['email']; ?></td>
<?php if ($this->control->tpl['nb_emailing']) { ?>
<td nowrap><?php echo $langs->trans("NbOfEMailingsReceived"); ?></td>
<td><a href="<?php echo DOL_URL_ROOT.'/comm/mailing/liste.php?filteremail='.urlencode($this->control->tpl['email']); ?>"><?php echo $this->control->tpl['nb_emailing']; ?></a></td>
<?php } else { ?>
<td colspan="2">&nbsp;</td>
<?php } ?>
</tr>
<tr>
<td><?php echo $langs->trans("Jabberid"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['jabberid']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['visibility']; ?></td>
</tr>
<tr>
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['note']; ?></td>
</tr>
<?php foreach ($this->control->tpl['contact_element'] as $element) { ?>
<tr>
<td><?php echo $element['linked_element_label']; ?></td>
<td colspan="3"><?php echo $element['linked_element_value']; ?></td>
</tr>
<?php } ?>
<tr>
<td><?php echo $langs->trans("DolibarrLogin"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['dolibarr_user']; ?></td>
</tr>
</table>
</div>
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE -->

File diff suppressed because it is too large Load Diff

View File

@ -84,9 +84,9 @@ class Canvas
* Execute actions * Execute actions
* @param Id of object (may be empty for creation) * @param Id of object (may be empty for creation)
*/ */
function doActions($socid) function doActions($id)
{ {
return $this->control->doActions($socid); return $this->control->doActions($id);
} }
/** /**
@ -118,13 +118,19 @@ class Canvas
{ {
$childmodule = $this->aliasmodule = $this->module = $regs[2]; $childmodule = $this->aliasmodule = $this->module = $regs[2];
$this->canvas = $regs[1]; $this->canvas = $regs[1];
}
// For compatibility
if ($childmodule == 'thirdparty') $childmodule = $this->aliasmodule = 'societe'; // For compatibility
if ($targetmodule == 'thirdparty') $targetmodule = 'societe'; if ($childmodule == 'thirdparty') $childmodule = $this->aliasmodule = 'societe';
if ($targetmodule == 'thirdparty') $targetmodule = 'societe';
if ($childmodule == 'contact')
{
$childmodule = 'societe';
$this->targetmodule = 'contact';
} }
//print 'childmodule='.$childmodule.' targetmodule='.$targetmodule.'<br>'; //print 'childmodule='.$childmodule.' targetmodule='.$targetmodule.'<br>';
//print 'this->aliasmodule='.$this->aliasmodule.' this->targetmodule='.$this->targetmodule.'<br>';
//print 'childmodule='.$conf->$childmodule->enabled.' targetmodule='.$conf->$targetmodule->enabled.'<br>'; //print 'childmodule='.$conf->$childmodule->enabled.' targetmodule='.$conf->$targetmodule->enabled.'<br>';
if (! $conf->$childmodule->enabled || ! $conf->$targetmodule->enabled) accessforbidden(); if (! $conf->$childmodule->enabled || ! $conf->$targetmodule->enabled) accessforbidden();
@ -159,6 +165,7 @@ class Canvas
} }
else else
{ {
//print 'access ko';
accessforbidden(); accessforbidden();
} }

View File

@ -485,19 +485,35 @@ class Form
print '</select>'; print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
} }
/** /**
* \brief Output html form to select a third party * Output html form to select a third party
* \param selected Preselected type * @param selected Preselected type
* \param htmlname Name of field in form * @param htmlname Name of field in form
* \param filter Optionnal filters criteras * @param filter Optionnal filters criteras
* \param showempty Add an empty field * @param showempty Add an empty field
* \param showtype Show third party type in combolist (customer, prospect or supplier) * @param showtype Show third party type in combolist (customer, prospect or supplier)
* \param forcecombo Force to use combo box * @param forcecombo Force to use combo box
*/ */
function select_societes($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0) function select_societes($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
{
print $this->select_company($selected,$htmlname,$filter,$showempty,$showtype,$forcecombo);
}
/**
* Output html form to select a third party
* @param selected Preselected type
* @param htmlname Name of field in form
* @param filter Optionnal filters criteras
* @param showempty Add an empty field
* @param showtype Show third party type in combolist (customer, prospect or supplier)
* @param forcecombo Force to use combo box
*/
function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
$out='';
// On recherche les societes // On recherche les societes
$sql = "SELECT s.rowid, s.nom, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql = "SELECT s.rowid, s.nom, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
@ -524,26 +540,26 @@ class Form
$socid = $obj->rowid?$obj->rowid:''; $socid = $obj->rowid?$obj->rowid:'';
} }
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (select_societes) -->'."\n"; $out.= "\n".'<!-- Input text for third party with Ajax.Autocompleter (select_societes) -->'."\n";
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; $out.= '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding">'; $out.= '<td class="nobordernopadding">';
if ($socid == 0) if ($socid == 0)
{ {
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="" />'; $out.= '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="" />';
} }
else else
{ {
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$obj->nom.'" />'; $out.= '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$obj->nom.'" />';
} }
print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '', $minLength); $out.= ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '', $minLength);
print '</td>'; $out.= '</td>';
print '</tr>'; $out.= '</tr>';
print '</table>'; $out.= '</table>';
} }
else else
{ {
print '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">'; $out.= '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">';
if ($showempty) print '<option value="-1">&nbsp;</option>'; if ($showempty) $out.=$out.= '<option value="-1">&nbsp;</option>';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
if ($num) if ($num)
@ -562,22 +578,24 @@ class Form
} }
if ($selected > 0 && $selected == $obj->rowid) if ($selected > 0 && $selected == $obj->rowid)
{ {
print '<option value="'.$obj->rowid.'" selected="selected">'.$label.'</option>'; $out.= '<option value="'.$obj->rowid.'" selected="selected">'.$label.'</option>';
} }
else else
{ {
print '<option value="'.$obj->rowid.'">'.$label.'</option>'; $out.= '<option value="'.$obj->rowid.'">'.$label.'</option>';
} }
$i++; $i++;
} }
} }
print '</select>'; $out.= '</select>';
} }
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
return $out;
} }

View File

@ -94,4 +94,6 @@ create table llx_c_ziptown
)type=innodb; )type=innodb;
ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_county (fk_county); ALTER TABLE llx_c_ziptown ADD INDEX idx_c_ziptown_fk_county (fk_county);
ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county FOREIGN KEY (fk_county) REFERENCES llx_c_departements (rowid); ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_county FOREIGN KEY (fk_county) REFERENCES llx_c_departements (rowid);
ALTER TABLE llx_socpeople ADD COLUMN canvas varchar(32) DEFAULT 'default@contact' after default_lang;

View File

@ -24,59 +24,59 @@
create table llx_societe create table llx_societe
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
statut tinyint DEFAULT 0, -- statut statut tinyint DEFAULT 0, -- statut
parent integer, parent integer,
tms timestamp, tms timestamp,
datec datetime, -- creation date datec datetime, -- creation date
datea datetime, -- activation date datea datetime, -- activation date
nom varchar(60), -- company name nom varchar(60), -- company name
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
code_client varchar(15), -- code client code_client varchar(15), -- code client
code_fournisseur varchar(15), -- code founisseur code_fournisseur varchar(15), -- code founisseur
code_compta varchar(15), -- code compta client code_compta varchar(15), -- code compta client
code_compta_fournisseur varchar(15), -- code compta founisseur code_compta_fournisseur varchar(15), -- code compta founisseur
address varchar(255), -- company adresse address varchar(255), -- company adresse
cp varchar(10), -- zipcode cp varchar(10), -- zipcode
ville varchar(50), -- town ville varchar(50), -- town
fk_departement integer DEFAULT 0, -- fk_departement integer DEFAULT 0, --
fk_pays integer DEFAULT 0, -- fk_pays integer DEFAULT 0, --
tel varchar(20), -- phone number tel varchar(20), -- phone number
fax varchar(20), -- fax number fax varchar(20), -- fax number
url varchar(255), -- url varchar(255), --
email varchar(128), -- email varchar(128), --
fk_secteur integer DEFAULT 0, -- fk_secteur integer DEFAULT 0, --
fk_effectif integer DEFAULT 0, -- fk_effectif integer DEFAULT 0, --
fk_typent integer DEFAULT 0, -- fk_typent integer DEFAULT 0, --
fk_forme_juridique integer DEFAULT 0, -- forme juridique INSEE fk_forme_juridique integer DEFAULT 0, -- forme juridique INSEE
siren varchar(16), -- IDProf1: siren ou RCS pour france siren varchar(16), -- IDProf1: siren ou RCS pour france
siret varchar(16), -- IDProf2: siret pour france siret varchar(16), -- IDProf2: siret pour france
ape varchar(16), -- IDProf3: code ape pour france ape varchar(16), -- IDProf3: code ape pour france
idprof4 varchar(16), -- IDProf4: nu pour france idprof4 varchar(16), -- IDProf4: nu pour france
tva_intra varchar(20), -- tva tva_intra varchar(20), -- tva
capital real, -- capital de la societe capital real, -- capital de la societe
description text, -- description text, --
fk_stcomm smallint DEFAULT 0, -- commercial statut fk_stcomm smallint DEFAULT 0, -- commercial statut
note text, -- note text, --
services tinyint DEFAULT 0, -- services tinyint DEFAULT 0, --
prefix_comm varchar(5), -- prefix commercial prefix_comm varchar(5), -- prefix commercial
client tinyint DEFAULT 0, -- client 0/1/2 client tinyint DEFAULT 0, -- client 0/1/2
fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 fournisseur tinyint DEFAULT 0, -- fournisseur 0/1
supplier_account varchar(32), -- compte client chez un fournisseur supplier_account varchar(32), -- compte client chez un fournisseur
fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel) fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel)
customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1 customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1
customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1) customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1)
supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1) supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1)
fk_user_creat integer NULL, -- utilisateur qui a cree l'info fk_user_creat integer NULL, -- utilisateur qui a cree l'info
fk_user_modif integer, -- utilisateur qui a modifie l'info fk_user_modif integer, -- utilisateur qui a modifie l'info
remise_client real DEFAULT 0, -- remise systematique pour le client remise_client real DEFAULT 0, -- remise systematique pour le client
mode_reglement tinyint, -- mode de reglement mode_reglement tinyint, -- mode de reglement
cond_reglement tinyint, -- condition de reglement cond_reglement tinyint, -- condition de reglement
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2 localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
gencod varchar(255), -- barcode gencod varchar(255), -- barcode
price_level integer NULL, -- level of price for multiprices price_level integer NULL, -- level of price for multiprices
default_lang varchar(6), -- default language default_lang varchar(6), -- default language
canvas varchar(32) DEFAULT 'default', -- type of canvas canvas varchar(32) DEFAULT 'default@thirdparty', -- type of canvas
import_key varchar(14) -- import key import_key varchar(14) -- import key
)type=innodb; )type=innodb;

View File

@ -1,7 +1,7 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> -- Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
@ -22,39 +22,32 @@
create table llx_socpeople create table llx_socpeople
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime, datec datetime,
tms timestamp, tms timestamp,
fk_soc integer, -- lien vers la societe fk_soc integer, -- lien vers la societe
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
civilite varchar(6), civilite varchar(6),
name varchar(50), name varchar(50),
firstname varchar(50), firstname varchar(50),
address varchar(255), address varchar(255),
cp varchar(25), cp varchar(25),
ville varchar(255), ville varchar(255),
fk_departement integer, fk_departement integer,
fk_pays integer DEFAULT 0, fk_pays integer DEFAULT 0,
birthday date, birthday date,
poste varchar(80), poste varchar(80),
phone varchar(30), phone varchar(30),
phone_perso varchar(30), phone_perso varchar(30),
phone_mobile varchar(30), phone_mobile varchar(30),
fax varchar(30), fax varchar(30),
email varchar(255), email varchar(255),
jabberid varchar(255), jabberid varchar(255),
priv smallint NOT NULL DEFAULT 0, priv smallint NOT NULL DEFAULT 0,
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
fk_user_modif integer, fk_user_modif integer,
note text, note text,
default_lang varchar(6), default_lang varchar(6),
import_key varchar(14) canvas varchar(32) DEFAULT 'default@contact', -- type of canvas
import_key varchar(14)
)type=innodb; )type=innodb;
--
-- List of codes for the field entity
--
-- 1 : first company contact
-- 2 : second company contact
-- 3 : etc...
--

View File

@ -187,9 +187,9 @@ class ActionsCardCommon
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur(); $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
$this->tpl['address'] = dol_nl2br($this->object->address); $this->tpl['address'] = dol_nl2br($this->object->address);
$img=picto_from_langcode($this->pays_code); $img=picto_from_langcode($this->object->pays_code);
if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->pays,$langs->trans("CountryIsInEEC"),1,0); if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0);
$this->tpl['country'] = ($img?$img.' ':'').$this->pays; $this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
$this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->pays_code,0,$this->object->id,'AC_TEL'); $this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->pays_code,0,$this->object->id,'AC_TEL');
$this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->pays_code,0,$this->object->id,'AC_FAX'); $this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->pays_code,0,$this->object->id,'AC_FAX');