Works on canvas integration in third party module

This commit is contained in:
Regis Houssin 2010-09-03 18:28:59 +00:00
parent 4060b73420
commit 0c39f20f8d
14 changed files with 1083 additions and 906 deletions

View File

@ -31,7 +31,12 @@
class Canvas
{
var $card;
var $canvas;
var $module;
var $object;
var $control;
var $aliasmodule; // for compatibility
var $template_dir; // Directory with all core and external templates files
var $action;
var $smarty;
@ -46,43 +51,103 @@ class Canvas
{
$this->db = $DB;
}
/**
* Return the title of card
*/
function getTitle()
{
return $this->control->getTitle($this->action);
}
/**
* Assigne les valeurs POST dans l'objet
*/
function assign_post()
{
return $this->control->assign_post();
}
/**
* Fetch object values
* @param id Element id
*/
function fetch($id)
{
return $this->control->object->fetch($id, $this->action);
}
/**
* Load canvas
* @param element Element of canvas
* @param canvas Name of canvas
* @param card Type of card
* @param canvas Name of canvas (ex: default@mymodule)
*/
function load_canvas($element,$canvas)
function load_canvas($card,$canvas)
{
global $langs;
$part1=$part3=$element;
$part2=$canvas;
// For compatibility
if (preg_match('/^([^@]+)@([^@]+)$/i',$element,$regs))
{
$part1=$regs[2];
$part3=$regs[1];
}
$this->card = $card;
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
{
$part1=$regs[2];
$part2=$regs[1];
$this->aliasmodule = $this->module = $regs[2];
$this->canvas = $regs[1];
// For compatibility
if ($this->module == 'thirdparty') $this->aliasmodule = 'societe';
}
else
{
$this->error = $langs->trans('CanvasIsInvalid');
return 0;
}
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part3.'.'.$part2.'.class.php'))
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->module.'.'.$this->canvas.'.class.php'))
{
$filecanvas = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part3.'.'.$part2.'.class.php';
$classname = ucfirst($part3).ucfirst($part2);
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/tpl/';
// Include model class
$modelclassfile = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->module.'.'.$this->canvas.'.class.php';
include_once($modelclassfile);
// Include common controller class
$controlclassfile = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->card.'.common.class.php';
include_once($controlclassfile);
// Template dir
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/tpl/';
}
else
{
$this->error = $langs->trans('CanvasIsInvalid');
return 0;
}
}
/**
* Load type of action
* @param action Type of action
*/
function load_control($action)
{
global $langs;
$this->action = $action;
include_once($filecanvas);
$this->object = new $classname($this->db);
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->card.'.'.$this->canvas.'.class.php'))
{
// Include canvas controller class
$controlclassfile = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->card.'.'.$this->canvas.'.class.php';
include_once($controlclassfile);
// Instantiate canvas controller class
$controlclassname = ucfirst($this->card).ucfirst($this->canvas);
$this->control = new $controlclassname($this->db);
// Instantiate model class
$modelclassname = ucfirst($this->module).ucfirst($this->canvas);
$this->control->object = new $modelclassname($this->db);
// Need smarty
$this->smarty = $this->object->smarty;
return $this->object;
}
else
{
@ -91,37 +156,22 @@ class Canvas
}
}
/**
* Fetch object values
* @param id Element id
* @param action Type of action
*/
function fetch($id,$action='')
{
$this->action = $action;
$ret = $this->object->fetch($id,$action);
return $ret;
}
/**
* Assign templates values
* @param action Type of action
*/
function assign_values($action='')
function assign_values()
{
$this->action = $action;
if (!empty($this->smarty))
{
global $smarty;
$this->object->assign_smarty_values($smarty, $this->action);
$this->control->assign_smarty_values($smarty, $this->action);
$smarty->template_dir = $this->template_dir;
}
else
{
$this->object->assign_values($this->action);
$this->control->assign_values($this->action);
}
}
@ -141,7 +191,7 @@ class Canvas
}
else
{
include($this->template_dir.$this->action.'.tpl.php');
include($this->template_dir.$this->card.'_'.$this->action.'.tpl.php');
}
}

View File

@ -0,0 +1,407 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/societe/canvas/card.common.class.php
* \ingroup thirparty
* \brief Fichier de la classe Thirdparty card controller (common)
* \version $Id$
*/
/**
* \class CardCommon
* \brief Classe permettant la gestion des tiers par defaut
*/
class CardCommon
{
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
//! Template container
var $tpl = array();
//! Object container
var $object;
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
*/
function CardCommon($DB)
{
$this->db = $DB;
}
/**
* Assigne les valeurs par defaut pour le canvas
* @param action Type of template
*/
function assign_values($action='')
{
global $conf, $langs, $user, $mysoc, $canvas;
global $form, $formadmin, $formcompany;
if ($_GET["type"]=='f') { $this->object->fournisseur=1; }
if ($_GET["type"]=='c') { $this->object->client=1; }
if ($_GET["type"]=='p') { $this->object->client=2; }
if ($_GET["type"]=='cp') { $this->object->client=3; }
if ($_REQUEST["private"]==1) { $this->object->particulier=1; }
foreach($this->object as $key => $value)
{
$this->tpl[$key] = $value;
}
if ($action == 'create' || $action == 'edit')
{
// Chargement ajax
$this->tpl['ajax_select_thirdpartytype'] = $this->ajax_selectThirdPartyType($canvas);
$this->tpl['ajax_select_country'] = $this->ajax_selectCountry($action,$canvas);
// Load object modCodeClient
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeClient = new $module;
$this->tpl['auto_customercode'] = $modCodeClient->code_auto;
// We verified if the tag prefix is used
if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
// Load object modCodeFournisseur
$module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON;
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeFournisseur = new $module;
$this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
// We verified if the tag prefix is used
if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
// TODO create a function
$this->tpl['select_customertype'] = '<select class="flat" name="client">';
$this->tpl['select_customertype'].= '<option value="2"'.($this->object->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>';
$this->tpl['select_customertype'].= '<option value="3"'.($this->object->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>';
$this->tpl['select_customertype'].= '<option value="1"'.($this->object->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>';
$this->tpl['select_customertype'].= '<option value="0"'.($this->object->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
$this->tpl['select_customertype'].= '</select>';
// 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);
if ($conf->use_javascript_ajax && $conf->global->MAIN_AUTOFILL_TOWNFROMZIP) $this->tpl['autofilltownfromzip'] = '<input class="button" type="button" name="searchpostalcode" value="'.$langs->trans('FillTownFromZip').'" onclick="autofilltownfromzip_PopupPostalCode(\''.DOL_URL_ROOT.'\',cp.value,ville,pays_id,departement_id)">';
// Country
$this->tpl['select_country'] = $form->select_country($this->object->pays_id,'pays_id');
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State
if ($this->object->pays_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->departement_id,$this->object->pays_code);
else $this->tpl['select_state'] = $countrynotdefined;
// Language
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);
// VAT
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation
// Select users
$this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id,'commercial_id',1);
// Local Tax
// TODO mettre dans une classe propre au pays
if($mysoc->pays_code=='ES')
{
$this->tpl['localtax'] = '';
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1);
$this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1);
$this->tpl['localtax'].= '</td></tr>';
}
elseif($mysoc->localtax1_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1);
$this->tpl['localtax'].= '</td><tr>';
}
elseif($mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1);
$this->tpl['localtax'].= '</td><tr>';
}
}
}
if ($action == 'view')
{
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');
$this->tpl['checkcustomercode'] = $this->object->check_codeclient();
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
$this->tpl['address'] = dol_nl2br($this->object->address);
$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['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['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL');
$this->tpl['url'] = dol_print_url($this->object->url);
$this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
// 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");
}
}
// Local Tax
// TODO mettre dans une classe propre au pays
if($mysoc->pays_code=='ES')
{
$this->tpl['localtax'] = '';
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
$this->tpl['localtax'].= '<td>'.yn($this->object->localtax1_assuj).'</td>';
$this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
$this->tpl['localtax'].= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>';
}
elseif($mysoc->localtax1_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
$this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>';
}
elseif($mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
$this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>';
}
}
}
}
/**
* Assigne les valeurs POST dans l'objet
*/
function assign_post()
{
global $langs, $mysoc;
$this->object->id = $_POST["socid"];
$this->object->nom = $_POST["nom"];
$this->object->prefix_comm = $_POST["prefix_comm"];
$this->object->client = $_POST["client"];
$this->object->code_client = $_POST["code_client"];
$this->object->fournisseur = $_POST["fournisseur"];
$this->object->code_fournisseur = $_POST["code_fournisseur"];
$this->object->adresse = $_POST["adresse"]; // TODO obsolete
$this->object->address = $_POST["adresse"];
$this->object->cp = $_POST["cp"];
$this->object->ville = $_POST["ville"];
$this->object->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$this->object->departement_id = $_POST["departement_id"];
$this->object->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = $_POST["email"];
$this->object->url = $_POST["url"];
$this->object->capital = $_POST["capital"];
$this->object->siren = $_POST["idprof1"];
$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
// TODO move in business class
if ($this->object->pays_id)
{
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->pays_id;
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
}
else
{
dol_print_error($this->db);
}
$this->object->pays_code = $obj->code;
$this->object->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
}
}
/**
*
*/
function ajax_selectThirdPartyType($canvas)
{
global $conf, $langs;
$out='';
if ($conf->use_javascript_ajax)
{
$out.= "\n".'<script type="text/javascript" language="javascript">'."\n";
$out.= 'jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.private.value=0;
document.formsoc.submit();
});
jQuery("#radioprivate").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.private.value=1;
document.formsoc.submit();
});
});';
$out.= '</script>'."\n";
$out.= "<br>\n";
$out.= $langs->trans("ThirdPartyType").': &nbsp; ';
$out.= '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':'');
$out.= '> '.$langs->trans("Company/Fundation");
$out.= ' &nbsp; &nbsp; ';
$out.= '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.(! $_REQUEST["private"]?'':' checked="true"');
$out.= '> '.$langs->trans("Individual");
$out.= ' ('.$langs->trans("ToCreateContactWithSameName").')';
$out.= "<br>\n";
$out.= "<br>\n";
}
return $out;
}
/**
*
*/
function ajax_selectCountry($action,$canvas)
{
global $conf;
$out='';
if ($conf->use_javascript_ajax)
{
$out.= "\n".'<script type="text/javascript" language="javascript">'."\n";
$out.= 'jQuery(document).ready(function () {
jQuery("#selectpays_id").change(function() {
document.formsoc.action.value="'.$action.'";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.submit();
});
})';
$out.= '</script>'."\n";
}
return $out;
}
}
?>

View File

@ -0,0 +1,159 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/societe/canvas/default/card.default.class.php
* \ingroup thirparty
* \brief Fichier de la classe Thirdparty card controller (default canvas)
* \version $Id$
*/
/**
* \class ThirdPartyCardDefault
* \brief Classe permettant la gestion des tiers par defaut
*/
class CardDefault extends CardCommon
{
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
*/
function CardDefault($DB)
{
$this->db = $DB;
}
/**
* Return the title of card
*/
function getTitle($action)
{
global $langs;
$out='';
if ($action == 'view') $out.= $langs->trans("ThirdParty");
if ($action == 'edit') $out.= $langs->trans("EditCompany");
if ($action == 'create') $out.= $langs->trans("NewCompany");
return $out;
}
/**
* Assign custom values for canvas
* @param action Type of action
*/
function assign_values($action='')
{
global $conf, $langs, $user, $mysoc;
global $form, $formadmin, $formcompany;
parent::assign_values($action);
$this->tpl['profid1'] = $this->object->siren;
$this->tpl['profid2'] = $this->object->siret;
$this->tpl['profid3'] = $this->object->ape;
$this->tpl['profid4'] = $this->object->idprof4;
if ($action == 'create' || $action == 'edit')
{
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]);
}
// Type
$this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id);
// Juridical Status
$this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->pays_code);
// Workforce
$this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id);
// VAT intra
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">';
$s.=' ';
if ($conf->use_javascript_ajax)
{
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
{
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
}
}
if ($action == 'view')
{
// Confirm delete third party
if ($_GET["action"] == 'delete')
{
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
}
for ($i=1; $i<=4; $i++)
{
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->pays_code);
$this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object);
$this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object);
}
// TVA intra
if ($this->tva_intra)
{
$s='';
$s.=$this->object->tva_intra;
$s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">';
$s.=' &nbsp; ';
if ($conf->use_javascript_ajax)
{
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
{
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
}
}
else
{
$this->tpl['tva_intra'] = '&nbsp;';
}
// Parent company
if ($this->object->parent)
{
$socm = new Societe($this->db);
$socm->fetch($this->object->parent);
$this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":"");
$this->tpl['parent_company'].= $socm->ville?' - '.$socm->ville:'';
}
else
{
$this->tpl['parent_company'] = $langs->trans("NoParentCompany");
}
}
}
}
?>

View File

@ -31,8 +31,6 @@ class ThirdPartyDefault extends Societe
{
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
//! Template container
var $tpl = array();
/**
* Constructeur de la classe
@ -40,32 +38,13 @@ class ThirdPartyDefault extends Societe
*/
function ThirdPartyDefault($DB)
{
$this->db = $DB;
$this->smarty = 0;
$this->module = "societe";
$this->canvas = "default";
$this->name = "default";
$this->definition = "Canvas des tiers (défaut)";
$this->fieldListName = "thirdparty_default";
}
function getTitle($action)
{
global $langs;
$out='';
if ($action == 'view') $out.= $langs->trans("ThirdParty");
if ($action == 'edit') $out.= $langs->trans("EditCompany");
if ($action == 'create') $out.= $langs->trans("NewCompany");
return $out;
$this->db = $DB;
}
/**
* Lecture des donnees dans la base
* @param id Product id
* @param id Product id
* @param action Type of action
*/
function fetch($id='', $action='')
{
@ -74,106 +53,6 @@ class ThirdPartyDefault extends Societe
return $result;
}
/**
* Assign custom values for canvas
* @param action Type of action
*/
function assign_values($action='')
{
global $conf, $langs, $user, $mysoc;
global $form, $formadmin, $formcompany;
parent::assign_values($action);
$this->tpl['profid1'] = $this->siren;
$this->tpl['profid2'] = $this->siret;
$this->tpl['profid3'] = $this->ape;
$this->tpl['profid4'] = $this->idprof4;
if ($action == 'create' || $action == 'edit')
{
for ($i=1; $i<=4; $i++)
{
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->pays_code);
$this->tpl['showprofid'.$i] = $this->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i]);
}
// Type
$this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->typent_id);
// Juridical Status
$this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->forme_juridique_code,$this->pays_code);
// Workforce
$this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->effectif_id);
// VAT intra
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->tva_intra.'">';
$s.=' ';
if ($conf->use_javascript_ajax)
{
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
{
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
}
}
if ($action == 'view')
{
// Confirm delete third party
if ($_GET["action"] == 'delete')
{
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
}
for ($i=1; $i<=4; $i++)
{
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->pays_code);
$this->tpl['checkprofid'.$i] = $this->id_prof_check($i,$this);
$this->tpl['urlprofid'.$i] = $this->id_prof_url($i,$this);
}
// TVA intra
if ($this->tva_intra)
{
$s='';
$s.=$this->tva_intra;
$s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->tva_intra.'">';
$s.=' &nbsp; ';
if ($conf->use_javascript_ajax)
{
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
{
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
}
}
else
{
$this->tpl['tva_intra'] = '&nbsp;';
}
// Parent company
if ($this->parent)
{
$socm = new Societe($this->db);
$socm->fetch($this->parent);
$this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":"");
$this->tpl['parent_company'].= $socm->ville?' - '.$socm->ville:'';
}
else
{
$this->tpl['parent_company'] = $langs->trans("NoParentCompany");
}
}
}
/**
* Fetch datas list
*/

View File

@ -21,16 +21,16 @@
<!-- BEGIN PHP TEMPLATE -->
<?php echo $this->object->tpl['ajax_select_thirdpartytype']; ?>
<?php echo $this->object->tpl['ajax_select_country']; ?>
<?php echo $this->control->tpl['ajax_select_thirdpartytype']; ?>
<?php echo $this->control->tpl['ajax_select_country']; ?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
<input type="hidden" name="action" value="add">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="private" value="<?php echo $this->object->tpl['particulier']; ?>">
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="private" value="<?php echo $this->control->tpl['particulier']; ?>">
<?php if ($this->control->tpl['auto_customercode'] || $this->control->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="code_auto" value="1">
<?php } ?>
@ -38,21 +38,21 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
<td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->object->tpl['nom']; ?>"></td>
<td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
<td><?php echo $langs->trans('Prefix'); ?></td>
<td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>"></td>
<td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>"></td>
</tr>
<tr>
<td width="25%"><span class="fieldrequired"><?php echo $langs->trans('ProspectCustomer'); ?></span></td>
<td width="25%"><?php echo $this->object->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $this->control->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $langs->trans('CustomerCode'); ?></td>
<td width="25%">
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->object->tpl['customercode']; ?>" maxlength="15"></td>
<td><?php echo $this->object->tpl['help_customercode']; ?></td>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15"></td>
<td><?php echo $this->control->tpl['help_customercode']; ?></td>
</tr>
</table>
</td>
@ -60,81 +60,81 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
<td><?php echo $this->object->tpl['yn_supplier']; ?></td>
<td><?php echo $this->control->tpl['yn_supplier']; ?></td>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->object->tpl['suppliercode']; ?>" maxlength="15"></td>
<td><?php echo $this->object->tpl['help_suppliercode']; ?></td>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>
</td>
</tr>
<?php
if ($this->object->tpl['fournisseur']) {
if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?>
if ($this->control->tpl['fournisseur']) {
if (sizeof($this->control->tpl['suppliercategory']) > 0) { ?>
<tr>
<td><?php echo $langs->trans('SupplierCategory'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_suppliercategory']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td>
</tr>
<?php } }?>
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr>
<td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->object->tpl['gencod']; ?>"></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td>
</tr>
<?php } ?>
<tr>
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->object->tpl['address']; ?></textarea></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->control->tpl['address']; ?></textarea></td>
</tr>
<tr>
<td><?php echo $langs->trans('Zip'); ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->object->tpl['cp']; ?>"><?php echo $this->object->tpl['autofilltownfromzip']; ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->control->tpl['cp']; ?>"><?php echo $this->control->tpl['autofilltownfromzip']; ?></td>
<td><?php echo $langs->trans('Town'); ?></td>
<td><input type="text" name="ville" value="<?php echo $this->object->tpl['ville']; ?>"></td>
<td><input type="text" name="ville" value="<?php echo $this->control->tpl['ville']; ?>"></td>
</tr>
<tr>
<td width="25%"><?php echo $langs->trans('Country'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_country']; echo $this->control->tpl['info_admin']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_state']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Phone'); ?></td>
<td><input type="text" name="tel" value="<?php echo $this->object->tpl['tel']; ?>"></td>
<td><input type="text" name="tel" value="<?php echo $this->control->tpl['tel']; ?>"></td>
<td><?php echo $langs->trans('Fax'); ?></td>
<td><input type="text" name="fax" value="<?php echo $this->object->tpl['fax']; ?>"></td>
<td><input type="text" name="fax" value="<?php echo $this->control->tpl['fax']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->object->tpl['email']; ?>"></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td>
<td><?php echo $langs->trans('Web'); ?></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->object->tpl['url']; ?>"></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('Capital'); ?></td>
<td colspan="3"><input type="text" name="capital" size="10" value="<?php echo $this->object->tpl['capital']; ?>"> <?php echo $langs->trans("Currency".$conf->monnaie); ?></td>
<td colspan="3"><input type="text" name="capital" size="10" value="<?php echo $this->control->tpl['capital']; ?>"> <?php echo $langs->trans("Currency".$conf->monnaie); ?></td>
</tr>
<?php
for ($i=1; $i<=4; $i++) {
if ($this->object->tpl['langprofid'.$i]!='-') {
if ($this->control->tpl['langprofid'.$i]!='-') {
if ($i==1 || $i==3) echo '<tr>';
echo '<td>'.$this->object->tpl['langprofid'.$i].'</td>';
echo '<td>'.$this->object->tpl['showprofid'.$i].'</td>';
echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>';
echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>';
if ($i==2 || $i==4) echo '</tr>';
} else {
if ($i==1 || $i==3) echo '<tr>';
@ -147,20 +147,20 @@ for ($i=1; $i<=4; $i++) {
<tr>
<td><?php echo $langs->trans('JuridicalStatus'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_juridicalstatus']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_juridicalstatus']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Type"); ?></td>
<td><?php echo $this->object->tpl['select_companytype']; echo $this->object->tpl['info_admin']; ?></td>
<td><?php echo $this->control->tpl['select_companytype']; echo $this->control->tpl['info_admin']; ?></td>
<td><?php echo $langs->trans("Staff"); ?></td>
<td><?php echo $this->object->tpl['select_workforce']; echo $this->object->tpl['info_admin']; ?></td>
<td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td>
</tr>
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
<tr>
<td><?php echo $langs->trans("DefaultLang"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_lang']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td>
</tr>
<?php } ?>
@ -174,17 +174,17 @@ function CheckVAT(a) {
<tr>
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
<td><?php echo $this->object->tpl['yn_assujtva']; ?></td>
<td><?php echo $this->control->tpl['yn_assujtva']; ?></td>
<td nowrap="nowrap"><?php echo $langs->trans('VATIntra'); ?></td>
<td nowrap="nowrap"><?php echo $this->object->tpl['tva_intra']; ?></td>
<td nowrap="nowrap"><?php echo $this->control->tpl['tva_intra']; ?></td>
</tr>
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
<?php if ($user->rights->societe->client->voir) { ?>
<tr>
<td><?php echo $langs->trans("AllocateCommercial"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_users']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_users']; ?></td>
</tr>
<?php } ?>

View File

@ -21,14 +21,14 @@
<!-- BEGIN PHP TEMPLATE -->
<?php echo $this->object->tpl['ajax_select_country']; ?>
<?php echo $this->control->tpl['ajax_select_country']; ?>
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->object->tpl['id']; ?>" method="POST" name="formsoc">
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc">
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
<input type="hidden" name="action" value="update">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="socid" value="<?php echo $this->object->tpl['id']; ?>">
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['id']; ?>">
<?php if ($this->control->tpl['auto_customercode'] || $this->control->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="code_auto" value="1">
<?php } ?>
@ -36,34 +36,34 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->object->tpl['nom']; ?>"></td>
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Prefix"); ?></td>
<td colspan="3">
<?php if (($this->tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->object->tpl['prefix_comm']) { ?>
<input type="hidden" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
<?php echo $this->object->tpl['prefix_comm']; ?>
<?php if (($this->tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->control->tpl['prefix_comm']) { ?>
<input type="hidden" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>">
<?php echo $this->control->tpl['prefix_comm']; ?>
<?php } else { ?>
<input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
<input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>">
<?php } ?>
<td>
</td>
<tr>
<td width="25%"><span class="fieldrequired"><?php echo $langs->trans('ProspectCustomer'); ?></span></td>
<td width="25%"><?php echo $this->object->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $this->control->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $langs->trans('CustomerCode'); ?></td>
<td width="25%">
<table class="nobordernopadding">
<tr>
<td>
<?php if ($this->object->tpl['ismodifiable_customercode']) { ?>
<input type="text" name="code_client" size="16" value="<?php echo $this->object->tpl['customercode']; ?>" maxlength="15">
<?php if ($this->control->tpl['ismodifiable_customercode']) { ?>
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15">
<?php } else { ?>
<?php echo $this->object->tpl['customercode']; ?>
<input type="hidden" name="code_client" value="<?php echo $this->object->tpl['customercode']; ?>">
<?php echo $this->control->tpl['customercode']; ?>
<input type="hidden" name="code_client" value="<?php echo $this->control->tpl['customercode']; ?>">
<?php } ?>
</td>
<td><?php echo $this->tpl['help_customercode']; ?></td>
@ -74,17 +74,17 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
<td><?php echo $this->object->tpl['yn_supplier']; ?></td>
<td><?php echo $this->control->tpl['yn_supplier']; ?></td>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td>
<?php if ($this->object->tpl['ismodifiable_suppliercode']) { ?>
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->object->tpl['suppliercode']; ?>" maxlength="15">
<?php if ($this->control->tpl['ismodifiable_suppliercode']) { ?>
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15">
<?php } else { ?>
<?php echo $this->object->tpl['suppliercode']; ?>
<input type="hidden" name="code_fournisseur" value="<?php echo $this->object->tpl['suppliercode']; ?>">
<?php echo $this->control->tpl['suppliercode']; ?>
<input type="hidden" name="code_fournisseur" value="<?php echo $this->control->tpl['suppliercode']; ?>">
<?php } ?>
</td>
<td><?php echo $this->tpl['help_suppliercode']; ?></td>
@ -94,68 +94,68 @@
</tr>
<?php
if ($this->object->tpl['fournisseur']) {
if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?>
if ($this->control->tpl['fournisseur']) {
if (sizeof($this->control->tpl['suppliercategory']) > 0) { ?>
<tr>
<td><?php echo $langs->trans('SupplierCategory'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_suppliercategory']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td>
</tr>
<?php } }?>
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr>
<td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->object->tpl['gencod']; ?>"></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td>
</tr>
<?php } ?>
<tr>
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->object->tpl['address']; ?></textarea></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->control->tpl['address']; ?></textarea></td>
</tr>
<tr>
<td><?php echo $langs->trans('Zip'); ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->object->tpl['cp']; ?>"><?php echo $this->object->tpl['autofilltownfromzip']; ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->control->tpl['cp']; ?>"><?php echo $this->control->tpl['autofilltownfromzip']; ?></td>
<td><?php echo $langs->trans('Town'); ?></td>
<td><input type="text" name="ville" value="<?php echo $this->object->tpl['ville']; ?>"></td>
<td><input type="text" name="ville" value="<?php echo $this->control->tpl['ville']; ?>"></td>
</tr>
<tr>
<td width="25%"><?php echo $langs->trans('Country'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_country']; echo $this->control->tpl['info_admin']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_state']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Phone'); ?></td>
<td><input type="text" name="tel" value="<?php echo $this->object->tpl['tel']; ?>"></td>
<td><input type="text" name="tel" value="<?php echo $this->control->tpl['tel']; ?>"></td>
<td><?php echo $langs->trans('Fax'); ?></td>
<td><input type="text" name="fax" value="<?php echo $this->object->tpl['fax']; ?>"></td>
<td><input type="text" name="fax" value="<?php echo $this->control->tpl['fax']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->object->tpl['email']; ?>"></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td>
<td><?php echo $langs->trans('Web'); ?></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->object->tpl['url']; ?>"></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('Capital'); ?></td>
<td colspan="3"><input type="text" name="capital" size="10" value="<?php echo $this->object->tpl['capital']; ?>"> <?php echo $langs->trans("Currency".$conf->monnaie); ?></td>
<td colspan="3"><input type="text" name="capital" size="10" value="<?php echo $this->control->tpl['capital']; ?>"> <?php echo $langs->trans("Currency".$conf->monnaie); ?></td>
</tr>
<?php
for ($i=1; $i<=4; $i++) {
if ($this->object->tpl['langprofid'.$i]!='-') {
if ($this->control->tpl['langprofid'.$i]!='-') {
if ($i==1 || $i==3) echo '<tr>';
echo '<td>'.$this->object->tpl['langprofid'.$i].'</td>';
echo '<td>'.$this->object->tpl['showprofid'.$i].'</td>';
echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>';
echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>';
if ($i==2 || $i==4) echo '</tr>';
} else {
if ($i==1 || $i==3) echo '<tr>';
@ -168,20 +168,20 @@ for ($i=1; $i<=4; $i++) {
<tr>
<td><?php echo $langs->trans('JuridicalStatus'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_juridicalstatus']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_juridicalstatus']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Type"); ?></td>
<td><?php echo $this->object->tpl['select_companytype']; echo $this->object->tpl['info_admin']; ?></td>
<td><?php echo $this->control->tpl['select_companytype']; echo $this->control->tpl['info_admin']; ?></td>
<td><?php echo $langs->trans("Staff"); ?></td>
<td><?php echo $this->object->tpl['select_workforce']; echo $this->object->tpl['info_admin']; ?></td>
<td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td>
</tr>
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
<tr>
<td><?php echo $langs->trans("DefaultLang"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_lang']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td>
</tr>
<?php } ?>
@ -195,12 +195,12 @@ function CheckVAT(a) {
<tr>
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
<td><?php echo $this->object->tpl['yn_assujtva']; ?></td>
<td><?php echo $this->control->tpl['yn_assujtva']; ?></td>
<td nowrap="nowrap"><?php echo $langs->trans('VATIntra'); ?></td>
<td nowrap="nowrap"><?php echo $this->object->tpl['tva_intra']; ?></td>
<td nowrap="nowrap"><?php echo $this->control->tpl['tva_intra']; ?></td>
</tr>
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
</table>
<br>

View File

@ -21,7 +21,7 @@
<!-- BEGIN PHP TEMPLATE -->
<?php if ($this->object->tpl['action_delete']) echo $this->object->tpl['action_delete']; ?>
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
<?php if ($mesg) { ?>
<div class="error"><?php echo $mesg; ?></div>
@ -34,30 +34,30 @@
<tr>
<td width="20%"><?php echo $langs->trans('Name'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['showrefnav']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Prefix'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['prefix_comm']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td>
</tr>
<?php if ($this->object->tpl['client']) { ?>
<?php if ($this->control->tpl['client']) { ?>
<tr>
<td><?php echo $langs->trans('CustomerCode'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['code_client']; ?>
<?php if ($this->object->tpl['checkcustomercode'] <> 0) { ?>
<td colspan="3"><?php echo $this->control->tpl['code_client']; ?>
<?php if ($this->control->tpl['checkcustomercode'] <> 0) { ?>
<font class="error">(<?php echo $langs->trans("WrongCustomerCode"); ?>)</font>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($this->object->tpl['fournisseur']) { ?>
<?php if ($this->control->tpl['fournisseur']) { ?>
<tr>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['code_fournisseur']; ?>
<?php if ($this->object->tpl['checksuppliercode'] <> 0) { ?>
<td colspan="3"><?php echo $this->control->tpl['code_fournisseur']; ?>
<?php if ($this->control->tpl['checksuppliercode'] <> 0) { ?>
<font class="error">(<?php echo $langs->trans("WrongSupplierCode"); ?>)</font>
<?php } ?>
</td>
@ -67,54 +67,54 @@
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr>
<td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['gencod']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['gencod']; ?></td>
</tr>
<?php } ?>
<tr>
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['address']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['address']; ?></td>
</tr>
<tr>
<td width="25%"><?php echo $langs->trans('Zip'); ?></td>
<td width="25%"><?php echo $this->object->tpl['cp']; ?></td>
<td width="25%"><?php echo $this->control->tpl['cp']; ?></td>
<td width="25%"><?php echo $langs->trans('Town'); ?></td>
<td width="25%"><?php echo $this->object->tpl['ville']; ?></td>
<td width="25%"><?php echo $this->control->tpl['ville']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Country"); ?></td>
<td colspan="3" nowrap="nowrap"><?php echo $this->object->tpl['country']; ?></td>
<td colspan="3" nowrap="nowrap"><?php echo $this->control->tpl['country']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['departement']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['departement']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Phone'); ?></td>
<td><?php echo $this->object->tpl['phone']; ?></td>
<td><?php echo $this->control->tpl['phone']; ?></td>
<td><?php echo $langs->trans('Fax'); ?></td>
<td><?php echo $this->object->tpl['fax']; ?></td>
<td><?php echo $this->control->tpl['fax']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('EMail'); ?></td>
<td><?php echo $this->object->tpl['email'];; ?></td>
<td><?php echo $this->control->tpl['email'];; ?></td>
<td><?php echo $langs->trans('Web'); ?></td>
<td><?php echo $this->object->tpl['url']; ?></td>
<td><?php echo $this->control->tpl['url']; ?></td>
</tr>
<?php
for ($i=1; $i<=4; $i++) {
if ($this->object->tpl['langprofid'.$i]!='-') {
if ($this->control->tpl['langprofid'.$i]!='-') {
if ($i==1 || $i==3) echo '<tr>';
echo '<td>'.$this->object->tpl['langprofid'.$i].'</td>';
echo '<td>'.$this->object->tpl['profid'.$i];
if ($this->object->tpl['profid'.$i]) {
if ($this->object->tpl['checkprofid'.$i] > 0) echo ' &nbsp; '.$this->object->tpl['urlprofid'.$i];
echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>';
echo '<td>'.$this->control->tpl['profid'.$i];
if ($this->control->tpl['profid'.$i]) {
if ($this->control->tpl['checkprofid'.$i] > 0) echo ' &nbsp; '.$this->control->tpl['urlprofid'.$i];
else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>';
}
echo '</td>';
@ -130,7 +130,7 @@ for ($i=1; $i<=4; $i++) {
<tr>
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
<td><?php echo $this->object->tpl['tva_assuj']; ?></td>
<td><?php echo $this->control->tpl['tva_assuj']; ?></td>
<?php if ($conf->use_javascript_ajax) { ?>
<script language="JavaScript" type="text/javascript">
@ -141,16 +141,16 @@ function CheckVAT(a) {
<?php } ?>
<td nowrap="nowrap"><?php echo $langs->trans('VATIntra'); ?></td>
<td><?php echo $this->object->tpl['tva_intra']; ?></td>
<td><?php echo $this->control->tpl['tva_intra']; ?></td>
</tr>
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
<tr>
<td><?php echo $langs->trans('Capital'); ?></td>
<td colspan="3">
<?php
if ($this->object->tpl['capital']) echo $this->object->tpl['capital'].' '.$langs->trans("Currency".$conf->monnaie);
if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->monnaie);
else echo '&nbsp;';
?>
</td>
@ -158,20 +158,20 @@ function CheckVAT(a) {
<tr>
<td><?php echo $langs->trans('JuridicalStatus'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['forme_juridique']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['forme_juridique']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Type"); ?></td>
<td><?php echo $this->object->tpl['typent']; ?></td>
<td><?php echo $this->control->tpl['typent']; ?></td>
<td><?php echo $langs->trans("Staff"); ?></td>
<td><?php echo $this->object->tpl['effectif']; ?></td>
<td><?php echo $this->control->tpl['effectif']; ?></td>
</tr>
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
<tr>
<td><?php echo $langs->trans("DefaultLang"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['default_lang']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td>
</tr>
<?php } ?>
@ -182,7 +182,7 @@ function CheckVAT(a) {
<td><?php echo $langs->trans('RIB'); ?></td>
<td align="right">
<?php if ($user->rights->societe->creer) { ?>
<a href="<?php echo DOL_URL_ROOT.'/societe/rib.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
<a href="<?php echo DOL_URL_ROOT.'/societe/rib.php?socid='.$this->control->tpl['id']; ?>"><?php echo $this->control->tpl['image_edit']; ?></a>
<?php } else { ?>
&nbsp;
<?php } ?>
@ -190,7 +190,7 @@ function CheckVAT(a) {
</tr>
</table>
</td>
<td colspan="3"><?php echo $this->object->tpl['display_rib']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['display_rib']; ?></td>
</tr>
<tr>
@ -200,7 +200,7 @@ function CheckVAT(a) {
<td><?php echo $langs->trans('ParentCompany'); ?></td>
<td align="right">
<?php if ($user->rights->societe->creer) { ?>
<a href="<?php echo DOL_URL_ROOT.'/societe/lien.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
<a href="<?php echo DOL_URL_ROOT.'/societe/lien.php?socid='.$this->control->tpl['id']; ?>"><?php echo $this->control->tpl['image_edit']; ?></a>
<?php } else { ?>
&nbsp;
<?php } ?>
@ -208,7 +208,7 @@ function CheckVAT(a) {
</tr>
</table>
</td>
<td colspan="3"><?php echo $this->object->tpl['parent_company']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['parent_company']; ?></td>
</tr>
<tr>
@ -218,7 +218,7 @@ function CheckVAT(a) {
<td><?php echo $langs->trans('SalesRepresentatives'); ?></td>
<td align="right">
<?php if ($user->rights->societe->creer) { ?>
<a href="<?php echo DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
<a href="<?php echo DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->control->tpl['id']; ?>"><?php echo $this->control->tpl['image_edit']; ?></a>
<?php } else { ?>
&nbsp;
<?php } ?>
@ -226,13 +226,13 @@ function CheckVAT(a) {
</tr>
</table>
</td>
<td colspan="3"><?php echo $this->object->tpl['sales_representatives']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td>
</tr>
<?php if ($conf->adherent->enabled) { ?>
<tr>
<td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['linked_member']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td>
</tr>
<?php } ?>

View File

@ -0,0 +1,85 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/societe/canvas/individual/card.individual.class.php
* \ingroup thirparty
* \brief Fichier de la classe Thirdparty card controller (individual canvas)
* \version $Id$
*/
/**
* \class CardIndividual
* \brief Classe permettant la gestion des particuliers
*/
class CardIndividual extends CardCommon
{
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
*/
function CardIndividual($DB)
{
$this->db = $DB;
}
/**
* Return the title of card
*/
function getTitle($action)
{
global $langs;
$out='';
if ($action == 'view') $out.= $langs->trans("Individual");
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
if ($action == 'create') $out.= $langs->trans("NewIndividual");
return $out;
}
/**
* Assign custom values for canvas
* @param action Type of action
*/
function assign_values($action='')
{
global $conf, $langs, $user, $mysoc;
global $form, $formadmin, $formcompany;
parent::assign_values($action);
if ($action == 'create' || $action == 'edit')
{
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
}
if ($action == 'view')
{
// Confirm delete third party
if ($_GET["action"] == 'delete')
{
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,2);
}
}
}
}
?>

View File

@ -31,37 +31,14 @@ class ThirdPartyIndividual extends Societe
{
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
//! Template container
var $tpl = array();
/**
* \brief Constructeur de la classe
* \param DB Handler acces base de donnees
* \param id Id produit (0 par defaut)
*/
function ThirdPartyIndividual($DB)
{
$this->db = $DB;
$this->smarty = 0;
$this->module = "societe";
$this->canvas = "individual";
$this->name = "individual";
$this->definition = "Canvas des particuliers";
$this->fieldListName = "thirdparty_individual";
}
function getTitle($action)
{
global $langs;
$out='';
if ($action == 'view') $out.= $langs->trans("Individual");
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
if ($action == 'create') $out.= $langs->trans("NewIndividual");
return $out;
$this->db = $DB;
}
/**
@ -77,33 +54,7 @@ class ThirdPartyIndividual extends Societe
}
/**
* Assign custom values for canvas
* @param action Type of action
*/
function assign_values($action='')
{
global $conf, $langs, $user, $mysoc;
global $form, $formadmin, $formcompany;
parent::assign_values($action);
if ($action == 'create' || $action == 'edit')
{
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
}
if ($action == 'view')
{
// Confirm delete third party
if ($_GET["action"] == 'delete')
{
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,2);
}
}
}
/**
* \brief Fetch datas list
* Fetch datas list
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{

View File

@ -21,16 +21,16 @@
<!-- BEGIN PHP TEMPLATE -->
<?php echo $this->object->tpl['ajax_select_thirdpartytype']; ?>
<?php echo $this->object->tpl['ajax_select_country']; ?>
<?php echo $this->control->tpl['ajax_select_thirdpartytype']; ?>
<?php echo $this->control->tpl['ajax_select_country']; ?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
<input type="hidden" name="action" value="add">
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="private" value="<?php echo $this->object->tpl['particulier']; ?>">
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="private" value="<?php echo $this->control->tpl['particulier']; ?>">
<?php if ($this->control->tpl['auto_customercode'] || $this->control->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="code_auto" value="1">
<?php } ?>
@ -38,33 +38,33 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('LastName'); ?></span></td>
<td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->object->tpl['nom']; ?>"></td>
<td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
<td><?php echo $langs->trans('Prefix'); ?></td>
<td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>"></td>
<td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('FirstName'); ?></td>
<td><input type="text" size="30" name="prenom" value="<?php echo $this->object->tpl['firstname']; ?>"></td>
<td><input type="text" size="30" name="prenom" value="<?php echo $this->control->tpl['firstname']; ?>"></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td><?php echo $langs->trans("UserTitle"); ?></td>
<td><?php echo $this->object->tpl['select_civility']; ?></td>
<td><?php echo $this->control->tpl['select_civility']; ?></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td width="25%"><span class="fieldrequired"><?php echo $langs->trans('ProspectCustomer'); ?></span></td>
<td width="25%"><?php echo $this->object->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $this->control->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $langs->trans('CustomerCode'); ?></td>
<td width="25%">
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->object->tpl['customercode']; ?>" maxlength="15"></td>
<td><?php echo $this->object->tpl['help_customercode']; ?></td>
<td><input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15"></td>
<td><?php echo $this->control->tpl['help_customercode']; ?></td>
</tr>
</table>
</td>
@ -72,88 +72,88 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
<td><?php echo $this->object->tpl['yn_supplier']; ?></td>
<td><?php echo $this->control->tpl['yn_supplier']; ?></td>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->object->tpl['suppliercode']; ?>" maxlength="15"></td>
<td><?php echo $this->object->tpl['help_suppliercode']; ?></td>
<td><input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15"></td>
<td><?php echo $this->control->tpl['help_suppliercode']; ?></td>
</tr>
</table>
</td>
</tr>
<?php
if ($this->object->tpl['fournisseur']) {
if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?>
if ($this->control->tpl['fournisseur']) {
if (sizeof($this->control->tpl['suppliercategory']) > 0) { ?>
<tr>
<td><?php echo $langs->trans('SupplierCategory'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_suppliercategory']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td>
</tr>
<?php } }?>
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr>
<td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->object->tpl['gencod']; ?>"></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td>
</tr>
<?php } ?>
<tr>
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->object->tpl['address']; ?></textarea></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->control->tpl['address']; ?></textarea></td>
</tr>
<tr>
<td><?php echo $langs->trans('Zip'); ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->object->tpl['cp']; ?>"><?php echo $this->object->tpl['autofilltownfromzip']; ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->control->tpl['cp']; ?>"><?php echo $this->control->tpl['autofilltownfromzip']; ?></td>
<td><?php echo $langs->trans('Town'); ?></td>
<td><input type="text" name="ville" value="<?php echo $this->object->tpl['ville']; ?>"></td>
<td><input type="text" name="ville" value="<?php echo $this->control->tpl['ville']; ?>"></td>
</tr>
<tr>
<td width="25%"><?php echo $langs->trans('Country'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_country']; echo $this->control->tpl['info_admin']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_state']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Phone'); ?></td>
<td><input type="text" name="tel" value="<?php echo $this->object->tpl['tel']; ?>"></td>
<td><input type="text" name="tel" value="<?php echo $this->control->tpl['tel']; ?>"></td>
<td><?php echo $langs->trans('Fax'); ?></td>
<td><input type="text" name="fax" value="<?php echo $this->object->tpl['fax']; ?>"></td>
<td><input type="text" name="fax" value="<?php echo $this->control->tpl['fax']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->object->tpl['email']; ?>"></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td>
<td><?php echo $langs->trans('Web'); ?></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->object->tpl['url']; ?>"></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td>
</tr>
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
<tr>
<td><?php echo $langs->trans("DefaultLang"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_lang']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td>
</tr>
<?php } ?>
<tr>
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['yn_assujtva']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td>
</tr>
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
<?php if ($user->rights->societe->client->voir) { ?>
<tr>
<td><?php echo $langs->trans("AllocateCommercial"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_users']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_users']; ?></td>
</tr>
<?php } ?>

View File

@ -21,15 +21,15 @@
<!-- BEGIN PHP TEMPLATE -->
<?php echo $this->object->tpl['ajax_select_country']; ?>
<?php echo $this->control->tpl['ajax_select_country']; ?>
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->object->tpl['id']; ?>" method="POST" name="formsoc">
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc">
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
<input type="hidden" name="action" value="update">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="socid" value="<?php echo $this->object->tpl['id']; ?>">
<input type="hidden" name="typent_id" value="<?php echo $this->object->tpl['typent_id']; ?>">
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['id']; ?>">
<input type="hidden" name="typent_id" value="<?php echo $this->control->tpl['typent_id']; ?>">
<?php if ($this->control->tpl['auto_customercode'] || $this->control->tpl['auto_suppliercode']) { ?>
<input type="hidden" name="code_auto" value="1">
<?php } ?>
@ -37,34 +37,34 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->object->tpl['nom']; ?>"></td>
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("Prefix"); ?></td>
<td colspan="3">
<?php if (($this->tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->object->tpl['prefix_comm']) { ?>
<input type="hidden" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
<?php echo $this->object->tpl['prefix_comm']; ?>
<?php if (($this->tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->control->tpl['prefix_comm']) { ?>
<input type="hidden" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>">
<?php echo $this->control->tpl['prefix_comm']; ?>
<?php } else { ?>
<input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
<input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>">
<?php } ?>
<td>
</td>
<tr>
<td width="25%"><span class="fieldrequired"><?php echo $langs->trans('ProspectCustomer'); ?></span></td>
<td width="25%"><?php echo $this->object->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $this->control->tpl['select_customertype']; ?></td>
<td width="25%"><?php echo $langs->trans('CustomerCode'); ?></td>
<td width="25%">
<table class="nobordernopadding">
<tr>
<td>
<?php if ($this->object->tpl['ismodifiable_customercode']) { ?>
<input type="text" name="code_client" size="16" value="<?php echo $this->object->tpl['customercode']; ?>" maxlength="15">
<?php if ($this->control->tpl['ismodifiable_customercode']) { ?>
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15">
<?php } else { ?>
<?php echo $this->object->tpl['customercode']; ?>
<input type="hidden" name="code_client" value="<?php echo $this->object->tpl['customercode']; ?>">
<?php echo $this->control->tpl['customercode']; ?>
<input type="hidden" name="code_client" value="<?php echo $this->control->tpl['customercode']; ?>">
<?php } ?>
</td>
<td><?php echo $this->tpl['help_customercode']; ?></td>
@ -75,17 +75,17 @@
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
<td><?php echo $this->object->tpl['yn_supplier']; ?></td>
<td><?php echo $this->control->tpl['yn_supplier']; ?></td>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td>
<table class="nobordernopadding">
<tr>
<td>
<?php if ($this->object->tpl['ismodifiable_suppliercode']) { ?>
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->object->tpl['suppliercode']; ?>" maxlength="15">
<?php if ($this->control->tpl['ismodifiable_suppliercode']) { ?>
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15">
<?php } else { ?>
<?php echo $this->object->tpl['suppliercode']; ?>
<input type="hidden" name="code_fournisseur" value="<?php echo $this->object->tpl['suppliercode']; ?>">
<?php echo $this->control->tpl['suppliercode']; ?>
<input type="hidden" name="code_fournisseur" value="<?php echo $this->control->tpl['suppliercode']; ?>">
<?php } ?>
</td>
<td><?php echo $this->tpl['help_suppliercode']; ?></td>
@ -95,70 +95,70 @@
</tr>
<?php
if ($this->object->tpl['fournisseur']) {
if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?>
if ($this->control->tpl['fournisseur']) {
if (sizeof($this->control->tpl['suppliercategory']) > 0) { ?>
<tr>
<td><?php echo $langs->trans('SupplierCategory'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_suppliercategory']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td>
</tr>
<?php } }?>
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr>
<td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->object->tpl['gencod']; ?>"></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td>
</tr>
<?php } ?>
<tr>
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->object->tpl['address']; ?></textarea></td>
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->control->tpl['address']; ?></textarea></td>
</tr>
<tr>
<td><?php echo $langs->trans('Zip'); ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->object->tpl['cp']; ?>"><?php echo $this->object->tpl['autofilltownfromzip']; ?></td>
<td><input size="6" type="text" name="cp" value="<?php echo $this->control->tpl['cp']; ?>"><?php echo $this->control->tpl['autofilltownfromzip']; ?></td>
<td><?php echo $langs->trans('Town'); ?></td>
<td><input type="text" name="ville" value="<?php echo $this->object->tpl['ville']; ?>"></td>
<td><input type="text" name="ville" value="<?php echo $this->control->tpl['ville']; ?>"></td>
</tr>
<tr>
<td width="25%"><?php echo $langs->trans('Country'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_country']; echo $this->control->tpl['info_admin']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_state']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Phone'); ?></td>
<td><input type="text" name="tel" value="<?php echo $this->object->tpl['tel']; ?>"></td>
<td><input type="text" name="tel" value="<?php echo $this->control->tpl['tel']; ?>"></td>
<td><?php echo $langs->trans('Fax'); ?></td>
<td><input type="text" name="fax" value="<?php echo $this->object->tpl['fax']; ?>"></td>
<td><input type="text" name="fax" value="<?php echo $this->control->tpl['fax']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->object->tpl['email']; ?>"></td>
<td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td>
<td><?php echo $langs->trans('Web'); ?></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->object->tpl['url']; ?>"></td>
<td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td>
</tr>
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
<tr>
<td><?php echo $langs->trans("DefaultLang"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['select_lang']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td>
</tr>
<?php } ?>
<tr>
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['yn_assujtva']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td>
</tr>
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
</table>
<br>

View File

@ -21,7 +21,7 @@
<!-- BEGIN PHP TEMPLATE -->
<?php if ($this->object->tpl['action_delete']) echo $this->object->tpl['action_delete']; ?>
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
<?php if ($mesg) { ?>
<div class="error"><?php echo $mesg; ?></div>
@ -34,30 +34,30 @@
<tr>
<td width="20%"><?php echo $langs->trans('Name'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['showrefnav']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Prefix'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['prefix_comm']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td>
</tr>
<?php if ($this->object->tpl['client']) { ?>
<?php if ($this->control->tpl['client']) { ?>
<tr>
<td><?php echo $langs->trans('CustomerCode'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['code_client']; ?>
<?php if ($this->object->tpl['checkcustomercode'] <> 0) { ?>
<td colspan="3"><?php echo $this->control->tpl['code_client']; ?>
<?php if ($this->control->tpl['checkcustomercode'] <> 0) { ?>
<font class="error">(<?php echo $langs->trans("WrongCustomerCode"); ?>)</font>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($this->object->tpl['fournisseur']) { ?>
<?php if ($this->control->tpl['fournisseur']) { ?>
<tr>
<td><?php echo $langs->trans('SupplierCode'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['code_fournisseur']; ?>
<?php if ($this->object->tpl['checksuppliercode'] <> 0) { ?>
<td colspan="3"><?php echo $this->control->tpl['code_fournisseur']; ?>
<?php if ($this->control->tpl['checksuppliercode'] <> 0) { ?>
<font class="error">(<?php echo $langs->trans("WrongSupplierCode"); ?>)</font>
<?php } ?>
</td>
@ -67,62 +67,62 @@
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr>
<td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['gencod']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['gencod']; ?></td>
</tr>
<?php } ?>
<tr>
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['address']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['address']; ?></td>
</tr>
<tr>
<td width="25%"><?php echo $langs->trans('Zip'); ?></td>
<td width="25%"><?php echo $this->object->tpl['cp']; ?></td>
<td width="25%"><?php echo $this->control->tpl['cp']; ?></td>
<td width="25%"><?php echo $langs->trans('Town'); ?></td>
<td width="25%"><?php echo $this->object->tpl['ville']; ?></td>
<td width="25%"><?php echo $this->control->tpl['ville']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Country"); ?></td>
<td colspan="3" nowrap="nowrap"><?php echo $this->object->tpl['country']; ?></td>
<td colspan="3" nowrap="nowrap"><?php echo $this->control->tpl['country']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('State'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['departement']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['departement']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('Phone'); ?></td>
<td><?php echo $this->object->tpl['phone']; ?></td>
<td><?php echo $this->control->tpl['phone']; ?></td>
<td><?php echo $langs->trans('Fax'); ?></td>
<td><?php echo $this->object->tpl['fax']; ?></td>
<td><?php echo $this->control->tpl['fax']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('EMail'); ?></td>
<td><?php echo $this->object->tpl['email'];; ?></td>
<td><?php echo $this->control->tpl['email'];; ?></td>
<td><?php echo $langs->trans('Web'); ?></td>
<td><?php echo $this->object->tpl['url']; ?></td>
<td><?php echo $this->control->tpl['url']; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
<td colspan="3"><?php echo $this->object->tpl['tva_assuj']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td>
</tr>
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
<tr>
<td><?php echo $langs->trans("Type"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['typent']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['typent']; ?></td>
</tr>
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
<tr>
<td><?php echo $langs->trans("DefaultLang"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['default_lang']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td>
</tr>
<?php } ?>
@ -133,7 +133,7 @@
<td><?php echo $langs->trans('RIB'); ?></td>
<td align="right">
<?php if ($user->rights->societe->creer) { ?>
<a href="<?php echo DOL_URL_ROOT.'/societe/rib.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
<a href="<?php echo DOL_URL_ROOT.'/societe/rib.php?socid='.$this->control->tpl['id']; ?>"><?php echo $this->control->tpl['image_edit']; ?></a>
<?php } else { ?>
&nbsp;
<?php } ?>
@ -141,7 +141,7 @@
</tr>
</table>
</td>
<td colspan="3"><?php echo $this->object->tpl['display_rib']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['display_rib']; ?></td>
</tr>
<tr>
@ -151,7 +151,7 @@
<td><?php echo $langs->trans('SalesRepresentatives'); ?></td>
<td align="right">
<?php if ($user->rights->societe->creer) { ?>
<a href="<?php echo DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
<a href="<?php echo DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->control->tpl['id']; ?>"><?php echo $this->control->tpl['image_edit']; ?></a>
<?php } else { ?>
&nbsp;
<?php } ?>
@ -159,13 +159,13 @@
</tr>
</table>
</td>
<td colspan="3"><?php echo $this->object->tpl['sales_representatives']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td>
</tr>
<?php if ($conf->adherent->enabled) { ?>
<tr>
<td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td>
<td colspan="3"><?php echo $this->object->tpl['linked_member']; ?></td>
<td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td>
</tr>
<?php } ?>

View File

@ -1301,6 +1301,7 @@ class Societe extends CommonObject
* \param option Sur quoi pointe le lien ('', 'customer', 'supplier', 'compta')
* \param maxlen Longueur max libelle
* \return string Chaine avec URL
* FIXME not in business class
*/
function getNomUrl($withpicto=0,$option='customer',$maxlen=0)
{
@ -1758,11 +1759,11 @@ class Societe extends CommonObject
}
/**
* \brief Verifie la validite d'un identifiant professionnel en
* fonction du pays de la societe (siren, siret, ...)
* \param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* \param soc Objet societe
* \return int <0 si ko, >0 si ok
* Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...)
* @param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param soc Objet societe
* @return int <0 si ko, >0 si ok
* FIXME not in business class
*/
function id_prof_check($idprof,$soc)
{
@ -1810,10 +1811,11 @@ class Societe extends CommonObject
}
/**
* \brief Renvoi url de verification d'un identifiant professionnal
* \param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* \param soc Objet societe
* \return string url ou chaine vide si aucune url connue
* Renvoi url de verification d'un identifiant professionnal
* @param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param soc Objet societe
* @return string url ou chaine vide si aucune url connue
* FIXME not in business class
*/
function id_prof_url($idprof,$soc)
{
@ -1997,9 +1999,9 @@ class Societe extends CommonObject
}
}
/*
* \brief Charge la liste des categories fournisseurs
* \return 0 in success, <> 0 in error
/**
* Charge la liste des categories fournisseurs
* @return 0 in success, <> 0 in error
*/
function AddFournisseurInCategory($categorie_id)
{
@ -2044,10 +2046,11 @@ class Societe extends CommonObject
}
/**
* \brief 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
* 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
* FIXME not in business class
*/
function show_input_id_prof($idprof,$htmlname,$preselected)
{
@ -2055,10 +2058,11 @@ class Societe extends CommonObject
}
/**
* \brief 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
* 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
* FIXME not in business class
*/
function get_input_id_prof($idprof,$htmlname,$preselected)
{
@ -2146,372 +2150,6 @@ class Societe extends CommonObject
}
}
// Functions for canvas feature (must be moved into template of page calling template)
// -----------------------------------------------------------------------------------
/**
* \brief Assigne les valeurs par defaut pour le canvas
* \param action Type of template
* FIXME Do not use presentation code on a business class
*/
function assign_values($action='')
{
global $conf, $langs, $user, $mysoc, $canvas;
global $form, $formadmin, $formcompany;
if ($_GET["type"]=='f') { $this->fournisseur=1; }
if ($_GET["type"]=='c') { $this->client=1; }
if ($_GET["type"]=='p') { $this->client=2; }
if ($_GET["type"]=='cp') { $this->client=3; }
if ($_REQUEST["private"]==1) { $this->particulier=1; }
foreach($this as $key => $value)
{
$this->tpl[$key] = $value;
}
if ($action == 'create' || $action == 'edit')
{
// Chargement ajax
$this->tpl['ajax_select_thirdpartytype'] = $this->ajax_selectThirdPartyType($canvas);
$this->tpl['ajax_select_country'] = $this->ajax_selectCountry($action,$canvas);
// Load object modCodeClient
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeClient = new $module;
$this->tpl['auto_customercode'] = $modCodeClient->code_auto;
// We verified if the tag prefix is used
if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
// Load object modCodeFournisseur
$module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON;
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeFournisseur = new $module;
$this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
// We verified if the tag prefix is used
if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
// TODO create a function
$this->tpl['select_customertype'] = '<select class="flat" name="client">';
$this->tpl['select_customertype'].= '<option value="2"'.($this->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>';
$this->tpl['select_customertype'].= '<option value="3"'.($this->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>';
$this->tpl['select_customertype'].= '<option value="1"'.($this->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>';
$this->tpl['select_customertype'].= '<option value="0"'.($this->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
$this->tpl['select_customertype'].= '</select>';
// Customer
$this->tpl['customercode'] = $this->code_client;
if ((!$this->code_client || $this->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this,0);
$this->tpl['ismodifiable_customercode'] = $this->codeclient_modifiable();
$s=$modCodeClient->getToolTip($langs,$this,0);
$this->tpl['help_customercode'] = $form->textwithpicto('',$s,1);
// Supplier
$this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->fournisseur,1);
$this->tpl['suppliercode'] = $this->code_fournisseur;
if ((!$this->code_fournisseur || $this->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this,1);
$this->tpl['ismodifiable_suppliercode'] = $this->codefournisseur_modifiable();
$s=$modCodeFournisseur->getToolTip($langs,$this,1);
$this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1);
$this->LoadSupplierCateg();
$this->tpl['suppliercategory'] = $this->SupplierCategories;
$this->tpl['select_suppliercategory'] = $form->selectarray("fournisseur_categorie",$this->SupplierCategories,$_POST["fournisseur_categorie"],1);
if ($conf->use_javascript_ajax && $conf->global->MAIN_AUTOFILL_TOWNFROMZIP) $this->tpl['autofilltownfromzip'] = '<input class="button" type="button" name="searchpostalcode" value="'.$langs->trans('FillTownFromZip').'" onclick="autofilltownfromzip_PopupPostalCode(\''.DOL_URL_ROOT.'\',cp.value,ville,pays_id,departement_id)">';
// Country
$this->tpl['select_country'] = $form->select_country($this->pays_id,'pays_id');
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State
if ($this->pays_id) $this->tpl['select_state'] = $formcompany->select_state($this->departement_id,$this->pays_code);
else $this->tpl['select_state'] = $countrynotdefined;
// Language
if ($conf->global->MAIN_MULTILANGS) $this->tpl['select_lang'] = $formadmin->select_language(($this->default_lang?$this->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1);
// VAT
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation
// Select users
$this->tpl['select_users'] = $form->select_dolusers($this->commercial_id,'commercial_id',1);
// Local Tax
// TODO mettre dans une classe propre au pays
if($mysoc->pays_code=='ES')
{
$this->tpl['localtax'] = '';
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->localtax1_assuj,1);
$this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->localtax1_assuj,1);
$this->tpl['localtax'].= '</td></tr>';
}
elseif($mysoc->localtax1_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->localtax1_assuj,1);
$this->tpl['localtax'].= '</td><tr>';
}
elseif($mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->localtax1_assuj,1);
$this->tpl['localtax'].= '</td><tr>';
}
}
}
if ($action == 'view')
{
$this->tpl['showrefnav'] = $form->showrefnav($this,'socid','',($user->societe_id?0:1),'rowid','nom');
$this->tpl['checkcustomercode'] = $this->check_codeclient();
$this->tpl['checksuppliercode'] = $this->check_codefournisseur();
$this->tpl['address'] = dol_nl2br($this->address);
$img=picto_from_langcode($this->pays_code);
if ($this->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->pays,$langs->trans("CountryIsInEEC"),1,0);
$this->tpl['country'] = ($img?$img.' ':'').$this->pays;
$this->tpl['phone'] = dol_print_phone($this->tel,$this->pays_code,0,$this->id,'AC_TEL');
$this->tpl['fax'] = dol_print_phone($this->fax,$this->pays_code,0,$this->id,'AC_FAX');
$this->tpl['email'] = dol_print_email($this->email,0,$this->id,'AC_EMAIL');
$this->tpl['url'] = dol_print_url($this->url);
$this->tpl['tva_assuj'] = yn($this->tpl['tva_assuj']);
// Third party type
$arr = $formcompany->typent_array(1);
$this->tpl['typent'] = $arr[$this->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->default_lang):'');
}
$this->tpl['image_edit'] = img_edit();
$this->tpl['display_rib'] = $this->display_rib();
// Sales representatives
$sql = "SELECT count(sc.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sc.fk_soc =".$this->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->id);
if ($result > 0)
{
$adh->ref=$adh->getFullName($langs);
$this->tpl['linked_member'] = $adh->getNomUrl(1);
}
else
{
$this->tpl['linked_member'] = $langs->trans("UserNotLinkedToMember");
}
}
// Local Tax
// TODO mettre dans une classe propre au pays
if($mysoc->pays_code=='ES')
{
$this->tpl['localtax'] = '';
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
$this->tpl['localtax'].= '<td>'.yn($this->localtax1_assuj).'</td>';
$this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
$this->tpl['localtax'].= '<td>'.yn($this->localtax2_assuj).'</td></tr>';
}
elseif($mysoc->localtax1_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
$this->tpl['localtax'].= '<td colspan="3">'.yn($this->localtax1_assuj).'</td></tr>';
}
elseif($mysoc->localtax2_assuj=="1")
{
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
$this->tpl['localtax'].= '<td colspan="3">'.yn($this->localtax2_assuj).'</td></tr>';
}
}
}
}
/**
* Assigne les valeurs POST dans l'objet
* FIXME Do not use presentation code on a business class
*/
function assign_post()
{
global $langs, $mysoc;
$this->id = $_POST["socid"];
$this->nom = $_POST["nom"];
$this->prefix_comm = $_POST["prefix_comm"];
$this->client = $_POST["client"];
$this->code_client = $_POST["code_client"];
$this->fournisseur = $_POST["fournisseur"];
$this->code_fournisseur = $_POST["code_fournisseur"];
$this->adresse = $_POST["adresse"]; // TODO obsolete
$this->address = $_POST["adresse"];
$this->cp = $_POST["cp"];
$this->ville = $_POST["ville"];
$this->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$this->departement_id = $_POST["departement_id"];
$this->tel = $_POST["tel"];
$this->fax = $_POST["fax"];
$this->email = $_POST["email"];
$this->url = $_POST["url"];
$this->capital = $_POST["capital"];
$this->siren = $_POST["idprof1"];
$this->siret = $_POST["idprof2"];
$this->ape = $_POST["idprof3"];
$this->idprof4 = $_POST["idprof4"];
$this->typent_id = $_POST["typent_id"];
$this->effectif_id = $_POST["effectif_id"];
$this->gencod = $_POST["gencod"];
$this->forme_juridique_code = $_POST["forme_juridique_code"];
$this->default_lang = $_POST["default_lang"];
$this->commercial_id = $_POST["commercial_id"];
$this->tva_assuj = $_POST["assujtva_value"]?$_POST["assujtva_value"]:1;
$this->tva_intra = $_POST["tva_intra"];
//Local Taxes
$this->localtax1_assuj = $_POST["localtax1assuj_value"];
$this->localtax2_assuj = $_POST["localtax2assuj_value"];
// We set pays_id, and pays_code label of the chosen country
if ($this->pays_id)
{
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->pays_id;
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
}
else
{
dol_print_error($this->db);
}
$this->pays_code = $obj->code;
$this->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
}
}
/**
* FIXME Do not use presentation code on a business class
* This code is used by non standard feature of canvas
*/
function ajax_selectThirdPartyType($canvas)
{
global $conf, $langs;
$out='';
if ($conf->use_javascript_ajax)
{
$out.= "\n".'<script type="text/javascript" language="javascript">'."\n";
$out.= 'jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.private.value=0;
document.formsoc.submit();
});
jQuery("#radioprivate").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.private.value=1;
document.formsoc.submit();
});
});';
$out.= '</script>'."\n";
$out.= "<br>\n";
$out.= $langs->trans("ThirdPartyType").': &nbsp; ';
$out.= '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':'');
$out.= '> '.$langs->trans("Company/Fundation");
$out.= ' &nbsp; &nbsp; ';
$out.= '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.(! $_REQUEST["private"]?'':' checked="true"');
$out.= '> '.$langs->trans("Individual");
$out.= ' ('.$langs->trans("ToCreateContactWithSameName").')';
$out.= "<br>\n";
$out.= "<br>\n";
}
return $out;
}
/**
* FIXME Do not use presentation code on a business class
* This code is used by non standard feature of canvas
*/
function ajax_selectCountry($action,$canvas)
{
global $conf;
$out='';
if ($conf->use_javascript_ajax)
{
$out.= "\n".'<script type="text/javascript" language="javascript">'."\n";
$out.= 'jQuery(document).ready(function () {
jQuery("#selectpays_id").change(function() {
document.formsoc.action.value="'.$action.'";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.submit();
});
})';
$out.= '</script>'."\n";
}
return $out;
}
}
?>

View File

@ -1587,11 +1587,12 @@ else
// When used with CANVAS
// -----------------------------------------
//$_GET["canvas"] = 'default';
//$_GET["canvas"] = 'default@thirdparty';
//$canvas = 'default@thirdparty';
//if ($_REQUEST["private"]==1) $_GET["canvas"] = 'individual'; To switch to other canvas, we must use another value for canvas
$soccanvas = new Canvas($db);
$soccanvas->load_canvas('thirdparty@societe',$canvas);
$soccanvas->load_canvas('card',$canvas);
/*
@ -1619,91 +1620,93 @@ else
if ($_POST["action"] == 'update')
{
// Load properties of company
$soccanvas->load_control('edit');
// Load properties of company
$soccanvas->fetch($socid);
}
if ($_REQUEST["private"] == 1)
{
$soccanvas->object->particulier = $_REQUEST["private"];
$soccanvas->control->object->particulier = $_REQUEST["private"];
$soccanvas->object->nom = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]);
$soccanvas->object->nom_particulier = $_POST["nom"];
$soccanvas->object->prenom = $_POST["prenom"];
$soccanvas->object->civilite_id = $_POST["civilite_id"];
$soccanvas->control->object->nom = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]);
$soccanvas->control->object->nom_particulier = $_POST["nom"];
$soccanvas->control->object->prenom = $_POST["prenom"];
$soccanvas->control->object->civilite_id = $_POST["civilite_id"];
}
else
{
$soccanvas->object->nom = $_POST["nom"];
$soccanvas->control->object->nom = $_POST["nom"];
}
$soccanvas->object->address = $_POST["adresse"];
$soccanvas->object->adresse = $_POST["adresse"]; // TODO obsolete
$soccanvas->object->cp = $_POST["cp"];
$soccanvas->object->ville = $_POST["ville"];
$soccanvas->object->pays_id = $_POST["pays_id"];
$soccanvas->object->departement_id = $_POST["departement_id"];
$soccanvas->object->tel = $_POST["tel"];
$soccanvas->object->fax = $_POST["fax"];
$soccanvas->object->email = trim($_POST["email"]);
$soccanvas->object->url = $_POST["url"];
$soccanvas->object->siren = $_POST["idprof1"];
$soccanvas->object->siret = $_POST["idprof2"];
$soccanvas->object->ape = $_POST["idprof3"];
$soccanvas->object->idprof4 = $_POST["idprof4"];
$soccanvas->object->prefix_comm = $_POST["prefix_comm"];
$soccanvas->object->code_client = $_POST["code_client"];
$soccanvas->object->code_fournisseur = $_POST["code_fournisseur"];
$soccanvas->object->capital = $_POST["capital"];
$soccanvas->object->gencod = $_POST["gencod"];
$soccanvas->object->canvas = $_GET["canvas"];
$soccanvas->control->object->address = $_POST["adresse"];
$soccanvas->control->object->adresse = $_POST["adresse"]; // TODO obsolete
$soccanvas->control->object->cp = $_POST["cp"];
$soccanvas->control->object->ville = $_POST["ville"];
$soccanvas->control->object->pays_id = $_POST["pays_id"];
$soccanvas->control->object->departement_id = $_POST["departement_id"];
$soccanvas->control->object->tel = $_POST["tel"];
$soccanvas->control->object->fax = $_POST["fax"];
$soccanvas->control->object->email = trim($_POST["email"]);
$soccanvas->control->object->url = $_POST["url"];
$soccanvas->control->object->siren = $_POST["idprof1"];
$soccanvas->control->object->siret = $_POST["idprof2"];
$soccanvas->control->object->ape = $_POST["idprof3"];
$soccanvas->control->object->idprof4 = $_POST["idprof4"];
$soccanvas->control->object->prefix_comm = $_POST["prefix_comm"];
$soccanvas->control->object->code_client = $_POST["code_client"];
$soccanvas->control->object->code_fournisseur = $_POST["code_fournisseur"];
$soccanvas->control->object->capital = $_POST["capital"];
$soccanvas->control->object->gencod = $_POST["gencod"];
$soccanvas->control->object->canvas = $_GET["canvas"];
$soccanvas->object->tva_assuj = $_POST["assujtva_value"];
$soccanvas->control->object->tva_assuj = $_POST["assujtva_value"];
// Local Taxes
$soccanvas->object->localtax1_assuj = $_POST["localtax1assuj_value"];
$soccanvas->object->localtax2_assuj = $_POST["localtax2assuj_value"];
$soccanvas->control->object->localtax1_assuj = $_POST["localtax1assuj_value"];
$soccanvas->control->object->localtax2_assuj = $_POST["localtax2assuj_value"];
$soccanvas->object->tva_intra = $_POST["tva_intra"];
$soccanvas->control->object->tva_intra = $_POST["tva_intra"];
$soccanvas->object->forme_juridique_code = $_POST["forme_juridique_code"];
$soccanvas->object->effectif_id = $_POST["effectif_id"];
$soccanvas->control->object->forme_juridique_code = $_POST["forme_juridique_code"];
$soccanvas->control->object->effectif_id = $_POST["effectif_id"];
if ($_REQUEST["private"] == 1)
{
$soccanvas->object->typent_id = 8; // TODO predict another method if the field "special" change of rowid
$soccanvas->control->object->typent_id = 8; // TODO predict another method if the field "special" change of rowid
}
else
{
$soccanvas->object->typent_id = $_POST["typent_id"];
$soccanvas->control->object->typent_id = $_POST["typent_id"];
}
$soccanvas->object->client = $_POST["client"];
$soccanvas->object->fournisseur = $_POST["fournisseur"];
$soccanvas->object->fournisseur_categorie = $_POST["fournisseur_categorie"];
$soccanvas->control->object->client = $_POST["client"];
$soccanvas->control->object->fournisseur = $_POST["fournisseur"];
$soccanvas->control->object->fournisseur_categorie = $_POST["fournisseur_categorie"];
$soccanvas->object->commercial_id = $_POST["commercial_id"];
$soccanvas->object->default_lang = $_POST["default_lang"];
$soccanvas->control->object->commercial_id = $_POST["commercial_id"];
$soccanvas->control->object->default_lang = $_POST["default_lang"];
// Check parameters
if (empty($_POST["cancel"]))
{
if (! empty($soccanvas->object->email) && ! isValidEMail($soccanvas->object->email))
if (! empty($soccanvas->control->object->email) && ! isValidEMail($soccanvas->control->object->email))
{
$error = 1;
$langs->load("errors");
$soccanvas->object->error = $langs->trans("ErrorBadEMail",$soccanvas->object->email);
$soccanvas->control->object->error = $langs->trans("ErrorBadEMail",$soccanvas->control->object->email);
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
}
if (! empty($soccanvas->object->url) && ! isValidUrl($soccanvas->object->url))
if (! empty($soccanvas->control->object->url) && ! isValidUrl($soccanvas->control->object->url))
{
$error = 1;
$langs->load("errors");
$soccanvas->object->error = $langs->trans("ErrorBadUrl",$soccanvas->object->url);
$soccanvas->control->object->error = $langs->trans("ErrorBadUrl",$soccanvas->control->object->url);
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
}
if ($soccanvas->object->fournisseur && ! $conf->fournisseur->enabled)
if ($soccanvas->control->object->fournisseur && ! $conf->fournisseur->enabled)
{
$error = 1;
$langs->load("errors");
$soccanvas->object->error = $langs->trans("ErrorSupplierModuleNotEnabled");
$soccanvas->control->object->error = $langs->trans("ErrorSupplierModuleNotEnabled");
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
}
}
@ -1714,27 +1717,27 @@ else
{
$db->begin();
if (empty($soccanvas->object->client)) $soccanvas->object->code_client='';
if (empty($soccanvas->object->fournisseur)) $soccanvas->object->code_fournisseur='';
if (empty($soccanvas->control->object->client)) $soccanvas->control->object->code_client='';
if (empty($soccanvas->control->object->fournisseur)) $soccanvas->control->object->code_fournisseur='';
$result = $soccanvas->object->create($user);
$result = $soccanvas->control->object->create($user);
if ($result >= 0)
{
if ($soccanvas->object->particulier)
if ($soccanvas->control->object->particulier)
{
dol_syslog("This thirdparty is a personal people",LOG_DEBUG);
$contact=new Contact($db);
$contact->civilite_id = $soccanvas->object->civilite_id;
$contact->name=$soccanvas->object->nom_particulier;
$contact->firstname=$soccanvas->object->prenom;
$contact->address=$soccanvas->object->address;
$contact->cp=$soccanvas->object->cp;
$contact->ville=$soccanvas->object->ville;
$contact->fk_pays=$soccanvas->object->fk_pays;
$contact->socid=$soccanvas->object->id; // fk_soc
$contact->civilite_id = $soccanvas->control->object->civilite_id;
$contact->name=$soccanvas->control->object->nom_particulier;
$contact->firstname=$soccanvas->control->object->prenom;
$contact->address=$soccanvas->control->object->address;
$contact->cp=$soccanvas->control->object->cp;
$contact->ville=$soccanvas->control->object->ville;
$contact->fk_pays=$soccanvas->control->object->fk_pays;
$contact->socid=$soccanvas->control->object->id; // fk_soc
$contact->status=1;
$contact->email=$soccanvas->object->email;
$contact->email=$soccanvas->control->object->email;
$contact->priv=0;
$result=$contact->create($user);
@ -1742,28 +1745,28 @@ else
}
else
{
$mesg=$soccanvas->object->error;
$mesg=$soccanvas->control->object->error;
}
if ($result >= 0)
{
$db->commit();
if ( $soccanvas->object->client == 1 )
if ( $soccanvas->control->object->client == 1 )
{
Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$soccanvas->object->id);
Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$soccanvas->control->object->id);
return;
}
else
{
if ( $soccanvas->object->fournisseur == 1 )
if ( $soccanvas->control->object->fournisseur == 1 )
{
Header("Location: ".DOL_URL_ROOT."/fourn/fiche.php?socid=".$soccanvas->object->id);
Header("Location: ".DOL_URL_ROOT."/fourn/fiche.php?socid=".$soccanvas->control->object->id);
return;
}
else
{
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$soccanvas->object->id);
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$soccanvas->control->object->id);
return;
}
}
@ -1774,7 +1777,7 @@ else
$db->rollback();
$langs->load("errors");
$mesg=$langs->trans($soccanvas->object->error);
$mesg=$langs->trans($soccanvas->control->object->error);
$_GET["action"]='create';
}
}
@ -1788,15 +1791,16 @@ else
}
$oldsoccanvas = new Canvas($db);
$oldsoccanvas->load_canvas('thirdparty@societe',$canvas);
$oldsoccanvas->load_canvas('card',$canvas);
$oldsoccanvas->load_control('edit');
$result=$oldsoccanvas->fetch($socid);
// To not set code if third party is not concerned. But if it had values, we keep them.
if (empty($soccanvas->object->client) && empty($oldsoccanvas->code_client)) $soccanvas->object->code_client='';
if (empty($soccanvas->object->fournisseur)&& empty($oldsoccanvas->code_fournisseur)) $soccanvas->object->code_fournisseur='';
if (empty($soccanvas->control->object->client) && empty($oldsoccanvas->control->object->code_client)) $soccanvas->control->object->code_client='';
if (empty($soccanvas->control->object->fournisseur)&& empty($oldsoccanvas->control->object->code_fournisseur)) $soccanvas->control->object->code_fournisseur='';
//var_dump($soccanvas);exit;
$result = $soccanvas->object->update($socid,$user,1,$oldsoccanvas->object->codeclient_modifiable(),$oldsoccanvas->object->codefournisseur_modifiable());
$result = $soccanvas->control->object->update($socid,$user,1,$oldsoccanvas->control->object->codeclient_modifiable(),$oldsoccanvas->control->object->codefournisseur_modifiable());
if ($result >= 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
@ -1804,10 +1808,10 @@ else
}
else
{
$soccanvas->object->id = $socid;
$soccanvas->control->object->id = $socid;
$reload = 0;
$mesg = $soccanvas->object->error;
$mesg = $soccanvas->control->object->error;
$_GET["action"]= "edit";
}
}
@ -1902,15 +1906,17 @@ else
*/
if ($user->rights->societe->creer)
{
$title = $soccanvas->object->getTitle('create');
$soccanvas->load_control('create');
$title = $soccanvas->getTitle();
print_fiche_titre($title);
$soccanvas->object->assign_post();
$soccanvas->assign_post();
// Assign values
$soccanvas->assign_values('create');
$soccanvas->assign_values();
dol_htmloutput_errors($soccanvas->object->error,$soccanvas->object->errors);
dol_htmloutput_errors($soccanvas->error,$soccanvas->errors);
// Display canvas
$soccanvas->display_canvas();
@ -1923,27 +1929,27 @@ else
* Company Fact Mode edition
*/
$title = $soccanvas->object->getTitle('edit');
$soccanvas->load_control('edit');
$title = $soccanvas->getTitle();
print_fiche_titre($title);
if ($socid)
{
if ($reload || ! $_POST["nom"])
{
$soccanvas = new Canvas($db);
$soccanvas->load_canvas('thirdparty@societe',$canvas);
$soccanvas->object->id = $socid;
$soccanvas->fetch($socid, 'edit');
$soc->id = $socid;
$soccanvas->fetch($socid);
}
else
{
$soccanvas->object->assign_post();
$soccanvas->assign_post();
}
dol_htmloutput_errors($soccanvas->object->error,$soccanvas->object->errors);
dol_htmloutput_errors($soccanvas->error,$soccanvas->errors);
// Assign values
$soccanvas->assign_values('edit');
$soccanvas->assign_values();
// Display canvas
$soccanvas->display_canvas();
@ -1955,7 +1961,9 @@ else
* Company Fact Sheet mode visu
*/
$soc->id = $socid;
$soccanvas->load_control('view');
$soc->id = $socid;
$result=$soccanvas->fetch($socid);
if ($result < 0)
{
@ -1963,13 +1971,13 @@ else
exit;
}
$head = societe_prepare_head($soc);
$title = $soccanvas->object->getTitle('view');
$head = societe_prepare_head($soccanvas->control->object);
$title = $soccanvas->getTitle('view');
dol_fiche_head($head, 'company', $title, 0, 'company');
// Assign values
$soccanvas->assign_values('view');
$soccanvas->assign_values();
// Display canvas
$soccanvas->display_canvas();