Test: not reload page with dialog confirm
Fix: form tag is not used in view mode Fix: debug error
This commit is contained in:
parent
632d8dde95
commit
f382a68dd7
@ -2057,8 +2057,10 @@ class Form
|
||||
$(function() {
|
||||
var choice=\'ko\';
|
||||
var $inputarray='.json_encode($inputarray).';
|
||||
var button=\''.$button.'\';
|
||||
var dialogconfirm=\''.$dialogconfirm.'\';
|
||||
|
||||
$("#'.$dialogconfirm.'").dialog({
|
||||
$( "#" + dialogconfirm ).dialog({
|
||||
autoOpen: '.($autoOpen?'true':'false').',
|
||||
resizable: false,
|
||||
height:'.$height.',
|
||||
@ -2092,9 +2094,11 @@ class Form
|
||||
}
|
||||
});
|
||||
|
||||
$( "#'.$button.'" ).click(function() {
|
||||
$( "#'.$dialogconfirm.'" ).dialog( \'open\' );
|
||||
});
|
||||
if (button.length > 0) {
|
||||
$( "#" + button ).click(function() {
|
||||
$( "#" + dialogconfirm ).dialog( \'open\' );
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
@ -3573,7 +3573,7 @@ function monthArrayOrSelected($selected=0)
|
||||
|
||||
|
||||
/**
|
||||
* Print formated messages to output (Used to show messages on html output)
|
||||
* Get formated messages to output (Used to show messages on html output)
|
||||
* @param mesgstring Message
|
||||
* @param mesgarray Messages array
|
||||
* @param style Style of message output
|
||||
@ -3582,7 +3582,7 @@ function monthArrayOrSelected($selected=0)
|
||||
* @see dol_print_error
|
||||
* @see dol_htmloutput_errors
|
||||
*/
|
||||
function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepembedded=0)
|
||||
function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepembedded=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -3620,20 +3620,50 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
|
||||
|
||||
if ($out)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JNOTIFY) && ! $keepembedded)
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JNOTIFY) && empty($keepembedded))
|
||||
{
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery.jnotify("'.dol_escape_js($out).'", "'.($style=="ok" ? 3000 : $style).'", '.($style=="ok" ? "false" : "true").');
|
||||
$return = '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.jnotify("'.dol_escape_js($out).'", "'.($style=="ok" ? 3000 : $style).'", '.($style=="ok" ? "false" : "true").');
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $out;
|
||||
$return = $out;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formated error messages to output (Used to show messages on html output)
|
||||
* @param mesgstring Error message
|
||||
* @param mesgarray Error messages array
|
||||
* @return keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
|
||||
* @return html Return html output
|
||||
* @see dol_print_error
|
||||
* @see dol_htmloutput_mesg
|
||||
*/
|
||||
function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
|
||||
{
|
||||
return get_htmloutput_mesg($mesgstring, $mesgarray,'error',$keepembedded);
|
||||
}
|
||||
|
||||
/**
|
||||
* print formated messages to output (Used to show messages on html output)
|
||||
* @param mesgstring Message
|
||||
* @param mesgarray Messages array
|
||||
* @param style Style of message output
|
||||
* @return string Return html output
|
||||
* @return $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
|
||||
* @see dol_print_error
|
||||
* @see dol_htmloutput_errors
|
||||
*/
|
||||
function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepembedded=0)
|
||||
{
|
||||
print get_htmloutput_mesg($mesgstring,$mesgarray,$style,$keepembedded);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3647,10 +3677,9 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
|
||||
*/
|
||||
function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
|
||||
{
|
||||
return dol_htmloutput_mesg($mesgstring, $mesgarray, 'error', $keepembedded);
|
||||
print get_htmloutput_errors($mesgstring, $mesgarray,$keepembedded);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Advanced sort array by second index function, which produces
|
||||
* ascending (default) or descending output and uses optionally
|
||||
|
||||
@ -385,8 +385,8 @@ class ActionsCardCommon
|
||||
}
|
||||
|
||||
$this->tpl['title'] = $this->getTitle($action);
|
||||
$this->tpl['error'] = $this->error;
|
||||
$this->tpl['errors']= $this->errors;
|
||||
|
||||
$this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
@ -410,7 +410,7 @@ class ActionsCardCommon
|
||||
</script>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
@ -538,10 +538,9 @@ class ActionsCardCommon
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
else
|
||||
{
|
||||
$this->tpl['showhead']=$this->showHead($action);
|
||||
$this->tpl['showhead']=$this->showHead('view');
|
||||
|
||||
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||
|
||||
|
||||
@ -146,13 +146,12 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
$this->tpl['tva_intra'] = $s;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
else
|
||||
{
|
||||
// Confirm delete third party
|
||||
if ($_GET["action"] == 'delete')
|
||||
if ($_GET["action"] == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX))
|
||||
{
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete");
|
||||
}
|
||||
|
||||
for ($i=1; $i<=4; $i++)
|
||||
|
||||
@ -21,16 +21,10 @@
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
?>
|
||||
|
||||
<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
|
||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
||||
|
||||
<form name="formsoc" method="POST">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
@ -231,7 +225,6 @@ for ($i=1; $i<=4; $i++) {
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@ -245,7 +238,11 @@ for ($i=1; $i<=4; $i++) {
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->societe->supprimer) { ?>
|
||||
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
|
||||
<?php if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) { ?>
|
||||
<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
|
||||
<?php } else { ?>
|
||||
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -96,13 +96,12 @@ class ActionsCardIndividual extends ActionsCardCommon
|
||||
{
|
||||
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
else
|
||||
{
|
||||
// Confirm delete third party
|
||||
if ($_GET["action"] == 'delete')
|
||||
if ($_GET["action"] == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX))
|
||||
{
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,2);
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,15 +21,9 @@
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
?>
|
||||
|
||||
<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
|
||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||
|
||||
<form name="formsoc" method="POST">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
@ -172,7 +166,6 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@ -186,7 +179,11 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->societe->supprimer) { ?>
|
||||
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
|
||||
<?php if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) { ?>
|
||||
<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
|
||||
<?php } else { ?>
|
||||
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -250,7 +250,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$soc->error;
|
||||
$error=$soc->error;
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
@ -268,7 +268,7 @@ else
|
||||
$db->rollback();
|
||||
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans($soc->error);
|
||||
$error=$langs->trans($soc->error);
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
@ -299,7 +299,7 @@ else
|
||||
{
|
||||
$soc->id = $socid;
|
||||
|
||||
$mesg = $soc->error;
|
||||
$error = $soc->error;
|
||||
$action= "edit";
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ else
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans($soc->error);
|
||||
$error=$langs->trans($soc->error);
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -333,7 +333,7 @@ else
|
||||
{
|
||||
if (is_numeric(GETPOST('model')))
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
||||
$error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -400,16 +400,16 @@ if (! empty($objcanvas->template_dir))
|
||||
{
|
||||
$objcanvas->fetch($socid); // Reload object
|
||||
if (! empty($_POST)) {
|
||||
$objcanvas->assign_post(); // Assign POST data
|
||||
$objcanvas->assign_post(); // Assign POST data
|
||||
}
|
||||
$objcanvas->assign_values($action); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$objcanvas->fetch($socid); // Relaod object
|
||||
$objcanvas->assign_values('view'); // Assign values
|
||||
$objcanvas->display_canvas('view'); // Show template
|
||||
$result=$objcanvas->fetch($socid); // Relaod object
|
||||
$objcanvas->assign_values(); // Assign values
|
||||
$objcanvas->display_canvas(); // Show template
|
||||
|
||||
// TODO Move this also into template
|
||||
print '<table width="100%"><tr><td valign="top" width="50%">';
|
||||
@ -1335,16 +1335,8 @@ else
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Template
|
||||
if ($mesg)
|
||||
{
|
||||
print '<div class="error">';
|
||||
print $mesg;
|
||||
print '</div>';
|
||||
}
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
|
||||
print '<form name="formsoc" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Name
|
||||
@ -1683,7 +1675,7 @@ else
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user