Fix: Wrong usage of new preoutput confirm box

This commit is contained in:
Laurent Destailleur 2013-10-26 18:46:07 +02:00
parent 1ae27b0977
commit f67537799b
2 changed files with 15 additions and 13 deletions

View File

@ -2499,7 +2499,7 @@ class Form
* @param string $action Action
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* @param string $selectedchoice "" or "no" or "yes"
* @param int $useajax 0=No, 1 or 'xxx'=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=preoutput confirm box with div id=dialog-confirm-xxx
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box
* @param int $width Force width of bow
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
@ -2588,10 +2588,12 @@ class Form
}
// JQUI method dialog is broken with jmobile, we use standard HTML.
// Note: When using dol_use_jmobile, you must also check code for button use a GET url with action=xxx and output the confirm code only when action=xxx
// Note: When using dol_use_jmobile or no js, you must also check code for button use a GET url with action=xxx and check that you also output the confirm code when action=xxx
// See page product/fiche.php for example
if (! empty($conf->dol_use_jmobile)) $useajax=0;
if (empty($conf->use_javascript_ajax)) $useajax=0;
if ($useajax && $conf->use_javascript_ajax)
if ($useajax)
{
$autoOpen=true;
$dialogconfirm='dialog-confirm';

View File

@ -1262,13 +1262,15 @@ $formquestionclone=array(
);
// Confirm delete product
if ($action == 'delete' && empty($conf->use_javascript_ajax))
if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
|| (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js
{
print $form->formconfirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete");
}
// Clone confirmation
if ($action == 'clone' && empty($conf->use_javascript_ajax))
if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
|| (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',250,600);
}
@ -1291,13 +1293,12 @@ if ($action == '' || $action == 'view')
if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
{
if (! empty($conf->use_javascript_ajax))
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
{
print '<div class="inline-block divButAction"><span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span></div>'."\n";
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',250,600);
}
else
{
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
}
}
@ -1309,23 +1310,22 @@ if ($action == '' || $action == 'view')
{
if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
{
if (! empty($conf->use_javascript_ajax))
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
{
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
print $form->formconfirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete");
}
else
{
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
}
}
else
{
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("ProductIsUsed").'">'.$langs->trans("Delete").'</a></div>';
}
}
else
{
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Delete").'</a></div>';
}
}