Works on canvas integration in third party module
This commit is contained in:
parent
e70f87ba4b
commit
c8fa0b67ec
@ -1788,8 +1788,7 @@ class Form
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
|
||||||
* Show a confirmation HTML form or AJAX popup
|
* Show a confirmation HTML form or AJAX popup
|
||||||
* @param page Url of page to call if confirmation is OK
|
* @param page Url of page to call if confirmation is OK
|
||||||
* @param title title
|
* @param title title
|
||||||
@ -1801,10 +1800,30 @@ class Form
|
|||||||
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
|
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
|
||||||
*/
|
*/
|
||||||
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
|
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a confirmation HTML form or AJAX popup
|
||||||
|
* @param page Url of page to call if confirmation is OK
|
||||||
|
* @param title title
|
||||||
|
* @param question question
|
||||||
|
* @param action action
|
||||||
|
* @param formquestion an array with forms complementary inputs
|
||||||
|
* @param selectedchoice "" or "no" or "yes"
|
||||||
|
* @param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
|
||||||
|
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
|
||||||
|
*/
|
||||||
|
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
$more='';
|
$more='';
|
||||||
|
$formconfirm='';
|
||||||
|
|
||||||
if ($formquestion)
|
if ($formquestion)
|
||||||
{
|
{
|
||||||
$more.='<tr class="valid"><td class="valid" colspan="3">'."\n";
|
$more.='<tr class="valid"><td class="valid" colspan="3">'."\n";
|
||||||
@ -1859,7 +1878,7 @@ class Form
|
|||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n<!-- begin form_confirm -->\n";
|
$formconfirm.= "\n<!-- begin form_confirm -->\n";
|
||||||
|
|
||||||
if ($useajax && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
if ($useajax && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||||
{
|
{
|
||||||
@ -1867,10 +1886,10 @@ class Form
|
|||||||
$pageno=($useajax == 2?$page.'&confirm=no':'');
|
$pageno=($useajax == 2?$page.'&confirm=no':'');
|
||||||
|
|
||||||
// New code using jQuery only
|
// New code using jQuery only
|
||||||
print '<div id="dialog-confirm" title="'.dol_escape_htmltag($title).'">';
|
$formconfirm.= '<div id="dialog-confirm" title="'.dol_escape_htmltag($title).'">';
|
||||||
print img_help('','').' '.$more.$question;
|
$formconfirm.= img_help('','').' '.$more.$question;
|
||||||
print '</div>'."\n";
|
$formconfirm.= '</div>'."\n";
|
||||||
print '<script type="text/javascript">
|
$formconfirm.= '<script type="text/javascript">
|
||||||
var choice=\'ko\';
|
var choice=\'ko\';
|
||||||
jQuery("#dialog-confirm").dialog({
|
jQuery("#dialog-confirm").dialog({
|
||||||
autoOpen: true,
|
autoOpen: true,
|
||||||
@ -1896,49 +1915,48 @@ class Form
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
print "\n";
|
$formconfirm.= "\n";
|
||||||
$ret='ajax';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$page.'" class="notoptoleftroright">'."\n";
|
$formconfirm.= '<form method="post" action="'.$page.'" class="notoptoleftroright">'."\n";
|
||||||
print '<input type="hidden" name="action" value="'.$action.'">';
|
$formconfirm.= '<input type="hidden" name="action" value="'.$action.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
$formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||||
|
|
||||||
print '<table width="100%" class="valid">'."\n";
|
$formconfirm.= '<table width="100%" class="valid">'."\n";
|
||||||
|
|
||||||
// Ligne titre
|
// Ligne titre
|
||||||
print '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'."\n";
|
$formconfirm.= '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'."\n";
|
||||||
|
|
||||||
// Ligne formulaire
|
// Ligne formulaire
|
||||||
print $more;
|
$formconfirm.= $more;
|
||||||
|
|
||||||
// Ligne message
|
// Ligne message
|
||||||
print '<tr class="valid">';
|
$formconfirm.= '<tr class="valid">';
|
||||||
print '<td class="valid">'.$question.'</td>';
|
$formconfirm.= '<td class="valid">'.$question.'</td>';
|
||||||
print '<td class="valid">';
|
$formconfirm.= '<td class="valid">';
|
||||||
$newselectedchoice=empty($selectedchoice)?"no":$selectedchoice;
|
$newselectedchoice=empty($selectedchoice)?"no":$selectedchoice;
|
||||||
print $this->selectyesno("confirm",$newselectedchoice);
|
$formconfirm.= $this->selectyesno("confirm",$newselectedchoice);
|
||||||
print '</td>';
|
$formconfirm.= '</td>';
|
||||||
print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>';
|
$formconfirm.= '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>';
|
||||||
print '</tr>'."\n";
|
$formconfirm.= '</tr>'."\n";
|
||||||
|
|
||||||
print '</table>'."\n";
|
$formconfirm.= '</table>'."\n";
|
||||||
|
|
||||||
if (is_array($formquestion))
|
if (is_array($formquestion))
|
||||||
{
|
{
|
||||||
foreach ($formquestion as $key => $input)
|
foreach ($formquestion as $key => $input)
|
||||||
{
|
{
|
||||||
if ($input['type'] == 'hidden') print '<input type="hidden" name="'.$input['name'].'" value="'.$input['value'].'">';
|
if ($input['type'] == 'hidden') $formconfirm.= '<input type="hidden" name="'.$input['name'].'" value="'.$input['value'].'">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</form>\n";
|
$formconfirm.= "</form>\n";
|
||||||
$ret='html';
|
$formconfirm.= '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<!-- end form_confirm -->\n";
|
$formconfirm.= "<!-- end form_confirm -->\n";
|
||||||
return $ret;
|
return $formconfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php if ($this->object->tpl['action_delete']) echo $this->object->tpl['action_delete']; ?>
|
||||||
|
|
||||||
<?php if ($mesg) { ?>
|
<?php if ($mesg) { ?>
|
||||||
<div class="error"><?php echo $mesg; ?></div>
|
<div class="error"><?php echo $mesg; ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
@ -2146,6 +2146,12 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
if ($action == 'view')
|
if ($action == 'view')
|
||||||
{
|
{
|
||||||
|
// Confirm delete third party
|
||||||
|
if ($_GET["action"] == 'delete')
|
||||||
|
{
|
||||||
|
$this->tpl['action_delete']=$form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
|
||||||
|
}
|
||||||
|
|
||||||
$this->tpl['showrefnav'] = $form->showrefnav($this,'socid','',($user->societe_id?0:1),'rowid','nom');
|
$this->tpl['showrefnav'] = $form->showrefnav($this,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||||
|
|
||||||
$this->tpl['checkcustomercode'] = $this->check_codeclient();
|
$this->tpl['checkcustomercode'] = $this->check_codeclient();
|
||||||
|
|||||||
@ -1177,14 +1177,6 @@ else
|
|||||||
|
|
||||||
dol_fiche_head($head, 'company', $langs->trans("ThirdParty"),0,'company');
|
dol_fiche_head($head, 'company', $langs->trans("ThirdParty"),0,'company');
|
||||||
|
|
||||||
// Confirm delete third party
|
|
||||||
if ($_GET["action"] == 'delete')
|
|
||||||
{
|
|
||||||
$html = new Form($db);
|
|
||||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
|
|
||||||
if ($ret == 'html') print '<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$soc->assign_values('view');
|
$soc->assign_values('view');
|
||||||
$soc->display_canvas();
|
$soc->display_canvas();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user