Fix: Confirm boxes with jmobile

This commit is contained in:
Laurent Destailleur 2013-08-01 04:20:08 +02:00
parent a334b96469
commit 53672dff75
2 changed files with 6 additions and 5 deletions

View File

@ -2475,7 +2475,7 @@ class Form
* @param string $action Action * @param string $action Action
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) * @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* @param string $selectedchoice "" or "no" or "yes" * @param string $selectedchoice "" or "no" or "yes"
* @param int $useajax 0=No, 1=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 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 $height Force height of box * @param int $height Force height of box
* @param int $width Force width of bow * @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 * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
@ -2563,6 +2563,8 @@ class Form
$more.='</table>'."\n"; $more.='</table>'."\n";
} }
if (! empty($conf->dol_use_jmobile)) $useajax=0; // JQUI method dialog is broken with jmobile, we use standard HTML. We also change code for button to have get on url with action=xxx and output confirm only when action=xxx
if ($useajax && $conf->use_javascript_ajax) if ($useajax && $conf->use_javascript_ajax)
{ {
$autoOpen=true; $autoOpen=true;
@ -2654,9 +2656,8 @@ class Form
} }
}); });
var button = "'.$button.'"; var button = "'.$button.'";
if (button.length > 0) { if (button.length > 0) {
$( "#" + button ).click(function() { $( "#" + button ).click(function() {
$("#'.$dialogconfirm.'").dialog("open"); $("#'.$dialogconfirm.'").dialog("open");
}); });

View File

@ -1438,7 +1438,7 @@ else
dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
// Confirm delete third party // Confirm delete third party
if ($action == 'delete' || $conf->use_javascript_ajax) if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)))
{ {
$form = new Form($db); $form = new Form($db);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete"); $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete");
@ -1786,7 +1786,7 @@ else
if ($user->rights->societe->supprimer) if ($user->rights->societe->supprimer)
{ {
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can(t use preloaded confirm form with jmobile
{ {
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n"; print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
} }