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() {
|
$(function() {
|
||||||
var choice=\'ko\';
|
var choice=\'ko\';
|
||||||
var $inputarray='.json_encode($inputarray).';
|
var $inputarray='.json_encode($inputarray).';
|
||||||
|
var button=\''.$button.'\';
|
||||||
|
var dialogconfirm=\''.$dialogconfirm.'\';
|
||||||
|
|
||||||
$("#'.$dialogconfirm.'").dialog({
|
$( "#" + dialogconfirm ).dialog({
|
||||||
autoOpen: '.($autoOpen?'true':'false').',
|
autoOpen: '.($autoOpen?'true':'false').',
|
||||||
resizable: false,
|
resizable: false,
|
||||||
height:'.$height.',
|
height:'.$height.',
|
||||||
@ -2092,9 +2094,11 @@ class Form
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#'.$button.'" ).click(function() {
|
if (button.length > 0) {
|
||||||
$( "#'.$dialogconfirm.'" ).dialog( \'open\' );
|
$( "#" + button ).click(function() {
|
||||||
});
|
$( "#" + dialogconfirm ).dialog( \'open\' );
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>';
|
</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 mesgstring Message
|
||||||
* @param mesgarray Messages array
|
* @param mesgarray Messages array
|
||||||
* @param style Style of message output
|
* @param style Style of message output
|
||||||
@ -3582,7 +3582,7 @@ function monthArrayOrSelected($selected=0)
|
|||||||
* @see dol_print_error
|
* @see dol_print_error
|
||||||
* @see dol_htmloutput_errors
|
* @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;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -3620,20 +3620,50 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
|
|||||||
|
|
||||||
if ($out)
|
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">
|
$return = '<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
$(document).ready(function() {
|
||||||
jQuery.jnotify("'.dol_escape_js($out).'", "'.($style=="ok" ? 3000 : $style).'", '.($style=="ok" ? "false" : "true").');
|
$.jnotify("'.dol_escape_js($out).'", "'.($style=="ok" ? 3000 : $style).'", '.($style=="ok" ? "false" : "true").');
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
else
|
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)
|
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
|
* Advanced sort array by second index function, which produces
|
||||||
* ascending (default) or descending output and uses optionally
|
* ascending (default) or descending output and uses optionally
|
||||||
|
|||||||
@ -385,8 +385,8 @@ class ActionsCardCommon
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl['title'] = $this->getTitle($action);
|
$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')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
@ -538,10 +538,9 @@ class ActionsCardCommon
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ($action == 'view')
|
|
||||||
{
|
{
|
||||||
$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');
|
$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;
|
$this->tpl['tva_intra'] = $s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ($action == 'view')
|
|
||||||
{
|
{
|
||||||
// Confirm delete third party
|
// 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++)
|
for ($i=1; $i<=4; $i++)
|
||||||
|
|||||||
@ -21,16 +21,10 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php
|
<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
|
||||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
<?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']; ?>
|
<?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%">
|
<table class="border" width="100%">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -231,7 +225,6 @@ for ($i=1; $i<=4; $i++) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -245,7 +238,11 @@ for ($i=1; $i<=4; $i++) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($user->rights->societe->supprimer) { ?>
|
<?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 } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -96,13 +96,12 @@ class ActionsCardIndividual extends ActionsCardCommon
|
|||||||
{
|
{
|
||||||
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ($action == 'view')
|
|
||||||
{
|
{
|
||||||
// Confirm delete third party
|
// 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 -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
<?php
|
<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
|
||||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
<?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%">
|
<table class="border" width="100%">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -172,7 +166,6 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -186,7 +179,11 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($user->rights->societe->supprimer) { ?>
|
<?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 } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -250,7 +250,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$soc->error;
|
$error=$soc->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
@ -268,7 +268,7 @@ else
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg=$langs->trans($soc->error);
|
$error=$langs->trans($soc->error);
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ else
|
|||||||
{
|
{
|
||||||
$soc->id = $socid;
|
$soc->id = $socid;
|
||||||
|
|
||||||
$mesg = $soc->error;
|
$error = $soc->error;
|
||||||
$action= "edit";
|
$action= "edit";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg=$langs->trans($soc->error);
|
$error=$langs->trans($soc->error);
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ else
|
|||||||
{
|
{
|
||||||
if (is_numeric(GETPOST('model')))
|
if (is_numeric(GETPOST('model')))
|
||||||
{
|
{
|
||||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
$error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -400,16 +400,16 @@ if (! empty($objcanvas->template_dir))
|
|||||||
{
|
{
|
||||||
$objcanvas->fetch($socid); // Reload object
|
$objcanvas->fetch($socid); // Reload object
|
||||||
if (! empty($_POST)) {
|
if (! empty($_POST)) {
|
||||||
$objcanvas->assign_post(); // Assign POST data
|
$objcanvas->assign_post(); // Assign POST data
|
||||||
}
|
}
|
||||||
$objcanvas->assign_values($action); // Set value for templates
|
$objcanvas->assign_values($action); // Set value for templates
|
||||||
$objcanvas->display_canvas($action); // Show template
|
$objcanvas->display_canvas($action); // Show template
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result=$objcanvas->fetch($socid); // Relaod object
|
$result=$objcanvas->fetch($socid); // Relaod object
|
||||||
$objcanvas->assign_values('view'); // Assign values
|
$objcanvas->assign_values(); // Assign values
|
||||||
$objcanvas->display_canvas('view'); // Show template
|
$objcanvas->display_canvas(); // Show template
|
||||||
|
|
||||||
// TODO Move this also into template
|
// TODO Move this also into template
|
||||||
print '<table width="100%"><tr><td valign="top" width="50%">';
|
print '<table width="100%"><tr><td valign="top" width="50%">';
|
||||||
@ -1335,16 +1335,8 @@ else
|
|||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Template
|
dol_htmloutput_errors($error,$errors);
|
||||||
if ($mesg)
|
|
||||||
{
|
|
||||||
print '<div class="error">';
|
|
||||||
print $mesg;
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<form name="formsoc" method="post">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
@ -1683,7 +1675,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user