';
print ' ';
$text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie));
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion);
diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php
index 0ab3bca493f..4a00c3c201c 100644
--- a/htdocs/compta/paiement/fiche.php
+++ b/htdocs/compta/paiement/fiche.php
@@ -51,7 +51,7 @@ $mesg='';
* Actions
*/
-if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
+if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
$db->begin();
@@ -71,7 +71,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user-
}
}
-if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
+if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
$db->begin();
@@ -143,7 +143,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice"));
*/
if ($_GET['action'] == 'delete')
{
- $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete');
+ $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
if ($ret == 'html') print ' ';
}
@@ -153,7 +153,7 @@ if ($_GET['action'] == 'delete')
if ($_GET['action'] == 'valide')
{
$facid = $_GET['facid'];
- $ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide');
+ $ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
if ($ret == 'html') print ' ';
}
diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php
index 35d6eeb03f9..32d3f59e854 100644
--- a/htdocs/contact.class.php
+++ b/htdocs/contact.class.php
@@ -610,6 +610,8 @@ class Contact extends CommonObject
$result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
+
+ if ($error) $this->error=join(',',$this->errors);
}
if (! $error)
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 39ec23d2d6f..98c6feeec4a 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -121,7 +121,7 @@ if ($_POST["action"] == 'add' && $user->rights->societe->contact->creer)
}
}
-if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->contact->supprimer)
+if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->contact->supprimer)
{
$contact = new Contact($db);
$result=$contact->fetch($_GET["id"]);
@@ -130,9 +130,15 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user-
$contact->old_firstname = $_POST["old_firstname"];
$result = $contact->delete();
-
- Header("Location: index.php");
- exit;
+ if ($result > 0)
+ {
+ Header("Location: index.php");
+ exit;
+ }
+ else
+ {
+ $mesg=$contact->error;
+ }
}
if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
@@ -223,7 +229,7 @@ if ($user->rights->societe->contact->supprimer)
{
if ($_GET["action"] == 'delete')
{
- $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete");
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
if ($ret == 'html') print ' ';
}
}
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 28ebba078f8..752712e0964 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -51,7 +51,7 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
* Actions
*/
-if ($_POST["action"] == 'confirm_active' && $_POST["confirm"] == 'yes' && $user->rights->contrat->activer)
+if ($_REQUEST["action"] == 'confirm_active' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
@@ -361,21 +361,21 @@ if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer)
}
}
-if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes' && $user->rights->contrat->creer)
+if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
$result = $contrat->validate($user,$langs,$conf);
}
-if ($_POST["action"] == 'confirm_close' && $_POST["confirm"] == 'yes' && $user->rights->contrat->creer)
+if ($_REQUEST["action"] == 'confirm_close' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
$result = $contrat->cloture($user,$langs,$conf);
}
-if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
+if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
{
if ($user->rights->contrat->supprimer)
{
@@ -394,7 +394,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
}
}
-if ($_POST["action"] == 'confirm_move' && $_POST["confirm"] == 'yes')
+if ($_REQUEST["action"] == 'confirm_move' && $_REQUEST["confirm"] == 'yes')
{
if ($user->rights->contrat->creer)
{
@@ -654,7 +654,7 @@ else
*/
if ($_GET["action"] == 'delete')
{
- $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete");
+ $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
if ($ret == 'html') print ' ';
}
@@ -664,7 +664,7 @@ else
if ($_GET["action"] == 'valid')
{
//$numfa = contrat_get_num($soc);
- $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid");
+ $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid",'',0,1);
if ($ret == 'html') print ' ';
}
@@ -673,7 +673,7 @@ else
*/
if ($_GET["action"] == 'close')
{
- $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close");
+ $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
if ($ret == 'html') print ' ';
}
@@ -995,7 +995,7 @@ else
$title=$langs->trans("CloseService");
$question=$langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y"));
$action="confirm_closeline";
- $html->form_confirm($page,$title,$question,$action,'','');
+ $html->form_confirm($page,$title,$question,$action,'',0,1);
print '';
}
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 4426abc096c..7df42250cbc 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -107,7 +107,7 @@ if ($_REQUEST['action'] == 'confirm_modify' && $_REQUEST['confirm'] == 'yes')
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
- $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
+ $result=fichinter_create($db, $fichinter, (empty($_REQUEST['model'])?$fichinter->model:$_REQUEST['model']), $outputlangs);
}
else
{
@@ -291,7 +291,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
/*
* Supprime une ligne d'intervention SANS confirmation
*/
-if ($_GET['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
+if ($_REQUEST['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
$fichinterline = new FichinterLigne($db);
if ($fichinterline->fetch($_GET['ligne']) <= 0)
@@ -522,28 +522,28 @@ elseif ($_GET["id"] > 0)
// Confirmation de la suppression de la fiche d'intervention
if ($_GET['action'] == 'delete')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete');
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1);
if ($ret == 'html') print ' ';
}
// Confirmation de la validation de la fiche d'intervention
if ($_GET['action'] == 'validate')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate');
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1);
if ($ret == 'html') print ' ';
}
// Confirmation de la validation de la fiche d'intervention
if ($_GET['action'] == 'modify')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify');
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1);
if ($ret == 'html') print ' ';
}
// Confirmation de la suppression d'une ligne d'intervention
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline');
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1);
if ($ret == 'html') print ' ';
}
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index b386ca1b78f..322fd6cd822 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -1541,20 +1541,73 @@ class Form
* \param action action
* \param formquestion an array with forms complementary inputs
* \param selectedchoice "" or "no" or "yes"
- * \param allowajax 0=No, 1=Yes (Yes works only if option activated)
+ * \param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
* \param 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="", $allowajax=0)
+ function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
{
global $langs,$conf;
+ $more='';
+ if ($formquestion)
+ {
+ $more.=' |