Clean code: View code was moved into view instead of controller.
This commit is contained in:
parent
bbb1db7a51
commit
0c159532a1
@ -71,10 +71,6 @@ class CardCommon
|
||||
|
||||
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"));
|
||||
@ -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 -->
|
||||
|
||||
<?php echo $this->control->tpl['ajax_select_thirdpartytype']; ?>
|
||||
<?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("#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">
|
||||
|
||||
|
||||
@ -21,7 +21,17 @@
|
||||
|
||||
<!-- 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">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
|
||||
@ -21,8 +21,42 @@
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $this->control->tpl['ajax_select_thirdpartytype']; ?>
|
||||
<?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("#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">
|
||||
|
||||
|
||||
@ -21,7 +21,17 @@
|
||||
|
||||
<!-- 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">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user