Clean code: View code was moved into view instead of controller.
This commit is contained in:
parent
bbb1db7a51
commit
0c159532a1
@ -30,7 +30,7 @@
|
|||||||
class CardCommon
|
class CardCommon
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
//! Numero d'erreur Plage 1280-1535
|
//! Numero d'erreur Plage 1280-1535
|
||||||
var $errno = 0;
|
var $errno = 0;
|
||||||
//! Template container
|
//! Template container
|
||||||
@ -48,7 +48,7 @@ class CardCommon
|
|||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigne les valeurs par defaut pour le canvas
|
* Assigne les valeurs par defaut pour le canvas
|
||||||
* @param action Type of template
|
* @param action Type of template
|
||||||
@ -71,10 +71,6 @@ class CardCommon
|
|||||||
|
|
||||||
if ($action == 'create' || $action == 'edit')
|
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
|
// Load object modCodeClient
|
||||||
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
||||||
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
|
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
|
||||||
@ -337,43 +333,43 @@ class CardCommon
|
|||||||
$this->object->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
$this->object->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load data control
|
* Load data control
|
||||||
*/
|
*/
|
||||||
function loadControl($socid)
|
function loadControl($socid)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
if ($_POST["getcustomercode"])
|
if ($_POST["getcustomercode"])
|
||||||
{
|
{
|
||||||
// We defined value code_client
|
// We defined value code_client
|
||||||
$_POST["code_client"]="Acompleter";
|
$_POST["code_client"]="Acompleter";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["getsuppliercode"])
|
if ($_POST["getsuppliercode"])
|
||||||
{
|
{
|
||||||
// We defined value code_fournisseur
|
// We defined value code_fournisseur
|
||||||
$_POST["code_fournisseur"]="Acompleter";
|
$_POST["code_fournisseur"]="Acompleter";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new third party
|
// Add new third party
|
||||||
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||||
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer)
|
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
if ($_POST["action"] == 'update')
|
||||||
{
|
{
|
||||||
// Load properties of company
|
// Load properties of company
|
||||||
$this->object->fetch($socid);
|
$this->object->fetch($socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST["private"] == 1)
|
if ($_REQUEST["private"] == 1)
|
||||||
{
|
{
|
||||||
$this->object->particulier = $_REQUEST["private"];
|
$this->object->particulier = $_REQUEST["private"];
|
||||||
|
|
||||||
$this->object->nom = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]);
|
$this->object->nom = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_POST["prenom"].' '.$_POST["nom"]):trim($_POST["nom"].' '.$_POST["prenom"]);
|
||||||
$this->object->nom_particulier = $_POST["nom"];
|
$this->object->nom_particulier = $_POST["nom"];
|
||||||
$this->object->prenom = $_POST["prenom"];
|
$this->object->prenom = $_POST["prenom"];
|
||||||
@ -383,7 +379,7 @@ class CardCommon
|
|||||||
{
|
{
|
||||||
$this->object->nom = $_POST["nom"];
|
$this->object->nom = $_POST["nom"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->object->address = $_POST["adresse"];
|
$this->object->address = $_POST["adresse"];
|
||||||
$this->object->adresse = $_POST["adresse"]; // TODO obsolete
|
$this->object->adresse = $_POST["adresse"]; // TODO obsolete
|
||||||
$this->object->cp = $_POST["cp"];
|
$this->object->cp = $_POST["cp"];
|
||||||
@ -406,12 +402,12 @@ class CardCommon
|
|||||||
$this->object->canvas = $_REQUEST["canvas"];
|
$this->object->canvas = $_REQUEST["canvas"];
|
||||||
|
|
||||||
$this->object->tva_assuj = $_POST["assujtva_value"];
|
$this->object->tva_assuj = $_POST["assujtva_value"];
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
||||||
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
||||||
$this->object->tva_intra = $_POST["tva_intra"];
|
$this->object->tva_intra = $_POST["tva_intra"];
|
||||||
|
|
||||||
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
|
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
|
||||||
$this->object->effectif_id = $_POST["effectif_id"];
|
$this->object->effectif_id = $_POST["effectif_id"];
|
||||||
if ($_REQUEST["private"] == 1)
|
if ($_REQUEST["private"] == 1)
|
||||||
@ -425,10 +421,10 @@ class CardCommon
|
|||||||
$this->object->client = $_POST["client"];
|
$this->object->client = $_POST["client"];
|
||||||
$this->object->fournisseur = $_POST["fournisseur"];
|
$this->object->fournisseur = $_POST["fournisseur"];
|
||||||
$this->object->fournisseur_categorie = $_POST["fournisseur_categorie"];
|
$this->object->fournisseur_categorie = $_POST["fournisseur_categorie"];
|
||||||
|
|
||||||
$this->object->commercial_id = $_POST["commercial_id"];
|
$this->object->commercial_id = $_POST["commercial_id"];
|
||||||
$this->object->default_lang = $_POST["default_lang"];
|
$this->object->default_lang = $_POST["default_lang"];
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($_POST["cancel"]))
|
if (empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
@ -454,16 +450,16 @@ class CardCommon
|
|||||||
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
$_GET["action"] = $_POST["action"]=='add'?'create':'edit';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (empty($this->object->client)) $this->object->code_client='';
|
if (empty($this->object->client)) $this->object->code_client='';
|
||||||
if (empty($this->object->fournisseur)) $this->object->code_fournisseur='';
|
if (empty($this->object->fournisseur)) $this->object->code_fournisseur='';
|
||||||
|
|
||||||
$result = $this->object->create($user);
|
$result = $this->object->create($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -471,7 +467,7 @@ class CardCommon
|
|||||||
{
|
{
|
||||||
dol_syslog("This thirdparty is a personal people",LOG_DEBUG);
|
dol_syslog("This thirdparty is a personal people",LOG_DEBUG);
|
||||||
$contact=new Contact($this->db);
|
$contact=new Contact($this->db);
|
||||||
|
|
||||||
$contact->civilite_id = $this->object->civilite_id;
|
$contact->civilite_id = $this->object->civilite_id;
|
||||||
$contact->name = $this->object->nom_particulier;
|
$contact->name = $this->object->nom_particulier;
|
||||||
$contact->firstname = $this->object->prenom;
|
$contact->firstname = $this->object->prenom;
|
||||||
@ -483,7 +479,7 @@ class CardCommon
|
|||||||
$contact->status = 1;
|
$contact->status = 1;
|
||||||
$contact->email = $this->object->email;
|
$contact->email = $this->object->email;
|
||||||
$contact->priv = 0;
|
$contact->priv = 0;
|
||||||
|
|
||||||
$result=$contact->create($user);
|
$result=$contact->create($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -491,11 +487,11 @@ class CardCommon
|
|||||||
{
|
{
|
||||||
$mesg=$this->object->error;
|
$mesg=$this->object->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
if ( $this->object->client == 1 )
|
if ( $this->object->client == 1 )
|
||||||
{
|
{
|
||||||
Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$this->object->id);
|
Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=".$this->object->id);
|
||||||
@ -519,13 +515,13 @@ class CardCommon
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg=$langs->trans($this->object->error);
|
$mesg=$langs->trans($this->object->error);
|
||||||
$_GET["action"]='create';
|
$_GET["action"]='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
if ($_POST["action"] == 'update')
|
||||||
{
|
{
|
||||||
if ($_POST["cancel"])
|
if ($_POST["cancel"])
|
||||||
@ -533,16 +529,16 @@ class CardCommon
|
|||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldsoccanvas = new Canvas($this->db);
|
$oldsoccanvas = new Canvas($this->db);
|
||||||
$oldsoccanvas->getCanvas('thirdparty','card',$this->canvas);
|
$oldsoccanvas->getCanvas('thirdparty','card',$this->canvas);
|
||||||
$result=$oldsoccanvas->fetch($socid);
|
$result=$oldsoccanvas->fetch($socid);
|
||||||
|
|
||||||
// To not set code if third party is not concerned. But if it had values, we keep them.
|
// To not set code if third party is not concerned. But if it had values, we keep them.
|
||||||
if (empty($this->object->client) && empty($oldsoccanvas->control->object->code_client)) $this->object->code_client='';
|
if (empty($this->object->client) && empty($oldsoccanvas->control->object->code_client)) $this->object->code_client='';
|
||||||
if (empty($this->object->fournisseur)&& empty($oldsoccanvas->control->object->code_fournisseur)) $this->object->code_fournisseur='';
|
if (empty($this->object->fournisseur)&& empty($oldsoccanvas->control->object->code_fournisseur)) $this->object->code_fournisseur='';
|
||||||
//var_dump($soccanvas);exit;
|
//var_dump($soccanvas);exit;
|
||||||
|
|
||||||
$result = $this->object->update($socid,$user,1,$oldsoccanvas->control->object->codeclient_modifiable(),$oldsoccanvas->control->object->codefournisseur_modifiable());
|
$result = $this->object->update($socid,$user,1,$oldsoccanvas->control->object->codeclient_modifiable(),$oldsoccanvas->control->object->codefournisseur_modifiable());
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -553,20 +549,20 @@ class CardCommon
|
|||||||
{
|
{
|
||||||
$this->object->id = $socid;
|
$this->object->id = $socid;
|
||||||
$reload = 0;
|
$reload = 0;
|
||||||
|
|
||||||
$mesg = $this->object->error;
|
$mesg = $this->object->error;
|
||||||
$_GET["action"]= "edit";
|
$_GET["action"]= "edit";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer)
|
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer)
|
||||||
{
|
{
|
||||||
$this->object->fetch($socid);
|
$this->object->fetch($socid);
|
||||||
|
|
||||||
$result = $this->object->delete($socid);
|
$result = $this->object->delete($socid);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->nom."");
|
Header("Location: ".DOL_URL_ROOT."/societe/societe.php?delsoc=".$this->object->nom."");
|
||||||
@ -580,7 +576,7 @@ class CardCommon
|
|||||||
$_GET["action"]='';
|
$_GET["action"]='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate document
|
* Generate document
|
||||||
*/
|
*/
|
||||||
@ -593,16 +589,16 @@ class CardCommon
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/societe/modules_societe.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/societe/modules_societe.class.php');
|
||||||
|
|
||||||
$this->object->fetch($socid);
|
$this->object->fetch($socid);
|
||||||
$this->object->fetch_thirdparty();
|
$this->object->fetch_thirdparty();
|
||||||
|
|
||||||
/*if ($_REQUEST['model'])
|
/*if ($_REQUEST['model'])
|
||||||
{
|
{
|
||||||
$fac->setDocModel($user, $_REQUEST['model']);
|
$fac->setDocModel($user, $_REQUEST['model']);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang='';
|
$newlang='';
|
||||||
@ -628,74 +624,6 @@ class CardCommon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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").': ';
|
|
||||||
$out.= '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':'');
|
|
||||||
$out.= '> '.$langs->trans("Company/Fundation");
|
|
||||||
$out.= ' ';
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -21,8 +21,42 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_select_thirdpartytype']; ?>
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
<?php echo $this->control->tpl['ajax_select_country']; ?>
|
<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#radiocompany").click(function() {
|
||||||
|
document.formsoc.action.value="create";
|
||||||
|
document.formsoc.canvas.value="default@societe";
|
||||||
|
document.formsoc.private.value=0;
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
jQuery("#radioprivate").click(function() {
|
||||||
|
document.formsoc.action.value="create";
|
||||||
|
document.formsoc.canvas.value="individual@societe";
|
||||||
|
document.formsoc.private.value=1;
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<?php echo $langs->trans("ThirdPartyType") ?>:
|
||||||
|
<input type="radio" id="radiocompany" class="flat" name="private" value="0"'<?php echo (! $_REQUEST["private"]?' checked="true"':''); ?>>
|
||||||
|
<?php echo $langs->trans("Company/Fundation"); ?>
|
||||||
|
<input type="radio" id="radioprivate" class="flat" name="private" value="1"'<?php echo (! $_REQUEST["private"]?'':' checked="true"'); ?>> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#selectpays_id").change(function() {
|
||||||
|
document.formsoc.action.value="create";
|
||||||
|
document.formsoc.canvas.value="<?php echo $canvas ?>";
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
|
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,17 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_select_country']; ?>
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#selectpays_id").change(function() {
|
||||||
|
document.formsoc.action.value="update";
|
||||||
|
document.formsoc.canvas.value="<?php echo $canvas ?>";
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->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="canvas" value="<?php echo $canvas ?>">
|
||||||
|
|||||||
@ -21,8 +21,42 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_select_thirdpartytype']; ?>
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
<?php echo $this->control->tpl['ajax_select_country']; ?>
|
<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#radiocompany").click(function() {
|
||||||
|
document.formsoc.action.value="create";
|
||||||
|
document.formsoc.canvas.value="default@societe";
|
||||||
|
document.formsoc.private.value=0;
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
jQuery("#radioprivate").click(function() {
|
||||||
|
document.formsoc.action.value="create";
|
||||||
|
document.formsoc.canvas.value="individual@societe";
|
||||||
|
document.formsoc.private.value=1;
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<?php echo $langs->trans("ThirdPartyType") ?>:
|
||||||
|
<input type="radio" id="radiocompany" class="flat" name="private" value="0"'<?php echo (! $_REQUEST["private"]?' checked="true"':''); ?>>
|
||||||
|
<?php echo $langs->trans("Company/Fundation"); ?>
|
||||||
|
<input type="radio" id="radioprivate" class="flat" name="private" value="1"'<?php echo (! $_REQUEST["private"]?'':' checked="true"'); ?>> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#selectpays_id").change(function() {
|
||||||
|
document.formsoc.action.value="create";
|
||||||
|
document.formsoc.canvas.value="<?php echo $canvas ?>";
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
|
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,17 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php echo $this->control->tpl['ajax_select_country']; ?>
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#selectpays_id").change(function() {
|
||||||
|
document.formsoc.action.value="update";
|
||||||
|
document.formsoc.canvas.value="<?php echo $canvas ?>";
|
||||||
|
document.formsoc.submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->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="canvas" value="<?php echo $canvas ?>">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user