Works on canvas integration in third party module
This commit is contained in:
parent
0c61e547ec
commit
66268368ac
@ -50,27 +50,34 @@ class Canvas
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Load canvas
|
||||
* \param Name of first part of canvas
|
||||
* \canvas Name of second part of canvas
|
||||
* Load canvas
|
||||
* @param $element Element of canvas
|
||||
* @param $canvas Name of canvas
|
||||
*/
|
||||
function load_canvas($object,$canvas)
|
||||
function load_canvas($element,$canvas)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$part1=$object;
|
||||
$part1=$part3=$element;
|
||||
$part2=$canvas;
|
||||
|
||||
// For compatibility
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$element,$regs))
|
||||
{
|
||||
$part1=$regs[2];
|
||||
$part3=$regs[1];
|
||||
}
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
||||
{
|
||||
$part1=$regs[2];
|
||||
$part1=$part3=$regs[2];
|
||||
$part2=$regs[1];
|
||||
}
|
||||
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part1.'.'.$part2.'.class.php'))
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part3.'.'.$part2.'.class.php'))
|
||||
{
|
||||
$filecanvas = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part1.'.'.$part2.'.class.php';
|
||||
$classname = ucfirst($part1).ucfirst($part2);
|
||||
$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_once($filecanvas);
|
||||
@ -121,7 +128,7 @@ class Canvas
|
||||
*/
|
||||
function display_canvas()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $user;
|
||||
|
||||
if (!empty($this->smarty))
|
||||
{
|
||||
|
||||
@ -49,22 +49,21 @@ function societe_prepare_head($objsoc)
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
||||
|
||||
if ($objsoc->client==1 || $objsoc->client==3)
|
||||
if ($objsoc->client==1 || $objsoc->client==3 || $objsoc->object->client==1 || $objsoc->object->client==3)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Customer");
|
||||
$head[$h][2] = 'customer';
|
||||
$h++;
|
||||
}
|
||||
if ($objsoc->client==2 || $objsoc->client==3)
|
||||
if ($objsoc->client==2 || $objsoc->client==3 || $objsoc->object->client==2 || $objsoc->object->client==3)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Prospect");
|
||||
$head[$h][2] = 'prospect';
|
||||
$h++;
|
||||
}
|
||||
if ($objsoc->fournisseur)
|
||||
if ($objsoc->fournisseur || $objsoc->object->fournisseur)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Supplier");
|
||||
|
||||
@ -50,8 +50,6 @@ class ThirdPartyDefault extends Societe
|
||||
$this->name = "default";
|
||||
$this->definition = "Canvas des tiers (défaut)";
|
||||
$this->fieldListName = "thirdparty_default";
|
||||
|
||||
$this->next_prev_filter = "canvas='default'";
|
||||
}
|
||||
|
||||
function getTitle()
|
||||
@ -73,13 +71,12 @@ class ThirdPartyDefault extends Societe
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Assigne les valeurs pour les templates
|
||||
* \param object object
|
||||
* \brief Assigne les valeurs complementaires pour le canvas
|
||||
* \param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
parent::assign_values($action);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -31,30 +31,30 @@
|
||||
|
||||
<tr>
|
||||
<td width="20%"><?php echo $langs->trans('Name'); ?></td>
|
||||
<td colspan="3"><?php echo $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom'); ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['showrefnav']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('Prefix'); ?></td>
|
||||
<td colspan="3"><?php echo $soc->prefix_comm; ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['prefix_comm']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($soc->client) { ?>
|
||||
<?php if ($this->object->tpl['client']) { ?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('CustomerCode'); ?></td>
|
||||
<td colspan="3"><?php echo $soc->code_client; ?>
|
||||
<?php if ($soc->check_codeclient() <> 0) { ?>
|
||||
<td colspan="3"><?php echo $this->object->tpl['code_client']; ?>
|
||||
<?php if ($this->object->tpl['checkcustomercode'] <> 0) { ?>
|
||||
<font class="error">(<?php echo $langs->trans("WrongCustomerCode"); ?>)</font>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($soc->fournisseur) { ?>
|
||||
<?php if ($this->object->tpl['fournisseur']) { ?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('SupplierCode'); ?></td>
|
||||
<td colspan="3"><?php echo $soc->code_fournisseur; ?>
|
||||
<?php if ($soc->check_codefournisseur() <> 0) { ?>
|
||||
<td colspan="3"><?php echo $this->object->tpl['code_fournisseur']; ?>
|
||||
<?php if ($this->object->tpl['checksuppliercode'] <> 0) { ?>
|
||||
<font class="error">(<?php echo $langs->trans("WrongSupplierCode"); ?>)</font>
|
||||
<?php } ?>
|
||||
</td>
|
||||
@ -64,119 +64,70 @@
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('Gencod'); ?></td>
|
||||
<td colspan="3"><?php echo $soc->gencod; ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['gencod']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
|
||||
<td colspan="3"><?php echo nl2br($soc->address); ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['address']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="25%"><?php echo $langs->trans('Zip'); ?></td>
|
||||
<td width="25%"><?php echo $soc->cp; ?></td>
|
||||
<td width="25%"><?php echo $this->object->tpl['cp']; ?></td>
|
||||
<td width="25%"><?php echo $langs->trans('Town'); ?></td>
|
||||
<td width="25%"><?php echo $soc->ville; ?></td>
|
||||
<td width="25%"><?php echo $this->object->tpl['ville']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Country"); ?></td>
|
||||
<td colspan="3" nowrap="nowrap">
|
||||
<?php
|
||||
$img=picto_from_langcode($soc->pays_code);
|
||||
if ($soc->isInEEC()) echo $form->textwithpicto(($img?$img.' ':'').$soc->pays,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else echo ($img?$img.' ':'').$soc->pays;
|
||||
?>
|
||||
</td>
|
||||
<td colspan="3" nowrap="nowrap"><?php echo $this->object->tpl['country']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('State'); ?></td>
|
||||
<td colspan="3"><?php echo $soc->departement; ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['departement']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('Phone'); ?></td>
|
||||
<td><?php echo dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL'); ?></td>
|
||||
<td><?php echo $this->object->tpl['phone']; ?></td>
|
||||
<td><?php echo $langs->trans('Fax'); ?></td>
|
||||
<td><?php echo dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX'); ?></td>
|
||||
<td><?php echo $this->object->tpl['fax']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('EMail'); ?></td>
|
||||
<td><?php echo dol_print_email($soc->email,0,$soc->id,'AC_EMAIL'); ?></td>
|
||||
<td><?php echo $this->object->tpl['email'];; ?></td>
|
||||
<td><?php echo $langs->trans('Web'); ?></td>
|
||||
<td><?php echo dol_print_url($soc->url); ?></td>
|
||||
<td><?php echo $this->object->tpl['url']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php $profid=$langs->transcountry('ProfId1',$soc->pays_code); ?>
|
||||
<?php if ($profid!='-') { ?>
|
||||
<tr>
|
||||
<td><?php echo $profid; ?></td>
|
||||
<td><?php echo $soc->siren; ?>
|
||||
<?php if ($soc->siren) {
|
||||
if ($soc->id_prof_check(1,$soc) > 0) print ' '.$soc->id_prof_url(1,$soc);
|
||||
else print ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>';
|
||||
} ?>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
|
||||
<?php $profid=$langs->transcountry('ProfId2',$soc->pays_code); ?>
|
||||
<?php if ($profid!='-') { ?>
|
||||
<td><?php echo $profid; ?></td>
|
||||
<td><?php echo $soc->siret; ?>
|
||||
<?php if ($soc->siret) {
|
||||
if ($soc->id_prof_check(2,$soc) > 0) print ' '.$soc->id_prof_url(2,$soc);
|
||||
else print ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>';
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php $profid=$langs->transcountry('ProfId3',$soc->pays_code); ?>
|
||||
<?php if ($profid!='-') { ?>
|
||||
<tr>
|
||||
<td><?php echo $profid; ?></td>
|
||||
<td><?php echo $soc->ape; ?>
|
||||
<?php if ($soc->ape) {
|
||||
if ($soc->id_prof_check(3,$soc) > 0) print ' '.$soc->id_prof_url(3,$soc);
|
||||
else print ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>';
|
||||
} ?>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
|
||||
<?php $profid=$langs->transcountry('ProfId4',$soc->pays_code); ?>
|
||||
<?php if ($profid!='-') { ?>
|
||||
<td><?php echo $profid; ?></td>
|
||||
<td><?php echo $soc->idprof4; ?>
|
||||
<?php if ($soc->idprof4) {
|
||||
if ($soc->id_prof_check(4,$soc) > 0) print ' '.$soc->id_prof_url(4,$soc);
|
||||
else print ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>';
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
for ($i=1; $i<=4; $i++) {
|
||||
if ($this->object->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 ' '.$this->object->tpl['urlprofid'.$i];
|
||||
else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>';
|
||||
}
|
||||
echo '</td>';
|
||||
if ($i==2 || $i==4) echo '<tr>';
|
||||
} else {
|
||||
if ($i==1 || $i==3) echo '<tr>';
|
||||
echo '<td> </td>';
|
||||
echo '<td> </td>';
|
||||
if ($i==2 || $i==4) echo '<tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
|
||||
<td><?php echo yn($soc->tva_assuj); ?></td>
|
||||
<td><?php echo $this->object->tpl['tva_assuj']; ?></td>
|
||||
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
@ -187,49 +138,16 @@ function CheckVAT(a) {
|
||||
<?php } ?>
|
||||
|
||||
<td nowrap="nowrap"><?php echo $langs->trans('VATIntra'); ?></td>
|
||||
<td>
|
||||
<?php if ($soc->tva_intra) {
|
||||
$s='';
|
||||
$s.=$soc->tva_intra;
|
||||
$s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$soc->tva_intra.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
echo $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
} else {
|
||||
echo $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
} else {
|
||||
echo ' ';
|
||||
} ?>
|
||||
</td>
|
||||
<td><?php echo $this->object->tpl['tva_intra']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if($mysoc->pays_code=='ES') {
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { ?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("LocalTax1IsUsedES"); ?></td>
|
||||
<td><?php echo yn($soc->localtax1_assuj); ?></td>
|
||||
<td><?php echo $langs->trans("LocalTax2IsUsedES"); ?></td>
|
||||
<td><?php echo yn($soc->localtax2_assuj); ?></td>
|
||||
</tr>
|
||||
<?php } elseif($mysoc->localtax1_assuj=="1") { ?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("LocalTax1IsUsedES"); ?></td>
|
||||
<td colspan="3"><?php echo yn($soc->localtax1_assuj); ?></td>
|
||||
<tr>
|
||||
<?php } elseif($mysoc->localtax2_assuj=="1") { ?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("LocalTax2IsUsedES"); ?></td>
|
||||
<td colspan="3"><?php echo yn($soc->localtax2_assuj); ?></td>
|
||||
<tr>
|
||||
<?php } } ?>
|
||||
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('Capital'); ?></td>
|
||||
<td colspan="3">
|
||||
<?php
|
||||
if ($soc->capital) echo $soc->capital.' '.$langs->trans("Currency".$conf->monnaie);
|
||||
if ($this->object->tpl['capital']) echo $this->object->tpl['capital'].' '.$langs->trans("Currency".$conf->monnaie);
|
||||
else echo ' ';
|
||||
?>
|
||||
</td>
|
||||
@ -237,33 +155,22 @@ function CheckVAT(a) {
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('JuridicalStatus'); ?></td>
|
||||
<td colspan="3"><?php echo $soc->forme_juridique; ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['forme_juridique']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$arr = $formcompany->typent_array(1);
|
||||
$soc->typent= $arr[$soc->typent_code];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Type"); ?></td>
|
||||
<td><?php echo $soc->typent; ?></td>
|
||||
<td><?php echo $this->object->tpl['typent']; ?></td>
|
||||
<td><?php echo $langs->trans("Staff"); ?></td>
|
||||
<td><?php echo $soc->effectif; ?></td>
|
||||
<td><?php echo $this->object->tpl['effectif']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||
echo '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3">';
|
||||
//$s=picto_from_langcode($soc->default_lang);
|
||||
//print ($s?$s.' ':'');
|
||||
$langs->load("languages");
|
||||
$labellang = ($soc->default_lang?$langs->trans('Language_'.$soc->default_lang):'');
|
||||
echo $labellang;
|
||||
echo '</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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
@ -272,7 +179,7 @@ if ($conf->global->MAIN_MULTILANGS)
|
||||
<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='.$soc->id; ?>"><?php echo img_edit(); ?></a>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/societe/rib.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
@ -280,7 +187,7 @@ if ($conf->global->MAIN_MULTILANGS)
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td colspan="3"><?php echo $soc->display_rib(); ?></td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['display_rib']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@ -290,7 +197,7 @@ if ($conf->global->MAIN_MULTILANGS)
|
||||
<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='.$soc->id; ?>"><?php echo img_edit(); ?></a>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/societe/lien.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
@ -298,16 +205,7 @@ if ($conf->global->MAIN_MULTILANGS)
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<?php if ($soc->parent) {
|
||||
$socm = new Societe($db);
|
||||
$socm->fetch($soc->parent);
|
||||
echo $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":"");
|
||||
echo $socm->ville?' - '.$socm->ville:'';
|
||||
} else {
|
||||
echo $langs->trans("NoParentCompany");
|
||||
} ?>
|
||||
</td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['parent_company']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@ -317,7 +215,7 @@ if ($conf->global->MAIN_MULTILANGS)
|
||||
<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='.$soc->id; ?>"><?php echo img_edit(); ?></a>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->tpl['id']; ?>"><?php echo $this->object->tpl['image_edit']; ?></a>
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
@ -325,41 +223,15 @@ if ($conf->global->MAIN_MULTILANGS)
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<?php
|
||||
$sql = "SELECT count(sc.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE sc.fk_soc =".$soc->id;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
echo $obj->nb?($obj->nb):$langs->trans("NoSalesRepresentativeAffected");
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td colspan="3"><?php echo $this->object->tpl['sales_representatives']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ($conf->adherent->enabled) {
|
||||
$langs->load("members");
|
||||
echo '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
echo '<td colspan="3">';
|
||||
$adh=new Adherent($db);
|
||||
$result=$adh->fetch('','',$soc->id);
|
||||
if ($result > 0) {
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
echo $adh->getNomUrl(1);
|
||||
} else {
|
||||
echo $langs->trans("UserNotLinkedToMember");
|
||||
}
|
||||
echo '</td>';
|
||||
echo "</tr>\n";
|
||||
}
|
||||
?>
|
||||
<?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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@ -2127,6 +2127,166 @@ class Societe extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Assigne les valeurs par defaut pour le canvas
|
||||
* \param action Type of template
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $formcompany;
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
foreach($this as $key => $value)
|
||||
{
|
||||
$this->tpl[$key] = $value;
|
||||
}
|
||||
|
||||
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['profid1'] = $this->siren;
|
||||
$this->tpl['profid2'] = $this->siret;
|
||||
$this->tpl['profid3'] = $this->ape;
|
||||
$this->tpl['profid4'] = $this->idprof4;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
$this->tpl['tva_assuj'] = yn($this->tpl['tva_assuj']);
|
||||
|
||||
// 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.=' ';
|
||||
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'] = ' ';
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
||||
// 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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formadmin.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
|
||||
@ -1157,7 +1158,13 @@ else
|
||||
/*
|
||||
* Company Fact Sheet mode visu
|
||||
*/
|
||||
$soc = new Societe($db);
|
||||
|
||||
// Call canvas
|
||||
if (empty($_GET["canvas"])) $_GET["canvas"]='default';
|
||||
|
||||
$soc = new Canvas($db,$user);
|
||||
$soc->load_canvas('thirdparty@societe',$_GET["canvas"]);
|
||||
|
||||
$soc->id = $socid;
|
||||
$result=$soc->fetch($socid);
|
||||
if ($result < 0)
|
||||
@ -1170,9 +1177,6 @@ else
|
||||
|
||||
dol_fiche_head($head, 'company', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
|
||||
// Confirm delete third party
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
@ -1180,10 +1184,9 @@ else
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Template
|
||||
// TODO utiliser la classe canvas
|
||||
include(DOL_DOCUMENT_ROOT."/societe/canvas/default/tpl/view.tpl.php");
|
||||
|
||||
$soc->assign_values('view');
|
||||
$soc->display_canvas();
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
Loading…
Reference in New Issue
Block a user