Fix: delete unused code
Fix: add form confirm function for hooks Fix: uniformize code
This commit is contained in:
parent
07bfba0db4
commit
e52daf6b8e
@ -1007,9 +1007,11 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
$formconfirm='';
|
||||
|
||||
// Clone confirmation
|
||||
if ($_GET["action"] == 'clone')
|
||||
if ($action == 'clone')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion=array(
|
||||
@ -1017,41 +1019,29 @@ if ($id > 0 || ! empty($ref))
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la propale
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete','',0,1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne produit/service
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deleteline')
|
||||
if ($action == 'ask_deleteline')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO ajout temporaire pour test en attendant la migration en template
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deletemilestone')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteMilestone'), $langs->trans('ConfirmDeleteMilestone'), 'confirm_deletemilestone','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation de la propale
|
||||
*/
|
||||
if ($_GET['action'] == 'validate')
|
||||
if ($action == 'validate')
|
||||
{
|
||||
// on verifie si l'objet est en numerotation provisoire
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
@ -1073,9 +1063,20 @@ if ($id > 0 || ! empty($ref))
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid);
|
||||
}
|
||||
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1);
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (empty($formconfirm) && ! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $module)
|
||||
{
|
||||
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
|
||||
}
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -1429,20 +1429,21 @@ else
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order');
|
||||
|
||||
$formconfirm='';
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la commande
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
if ($_GET['action'] == 'validate')
|
||||
if ($action == 'validate')
|
||||
{
|
||||
// on verifie si l'objet est en numerotation provisoire
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
@ -1463,48 +1464,35 @@ else
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_ORDER',$object->socid);
|
||||
}
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la cloture
|
||||
*/
|
||||
if ($_GET['action'] == 'close')
|
||||
if ($action == 'close')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de l'annulation
|
||||
*/
|
||||
if ($_GET['action'] == 'cancel')
|
||||
if ($action == 'cancel')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne produit
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deleteline')
|
||||
if ($action == 'ask_deleteline')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO ajout temporaire pour test en attendant la migration en template
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deletemilestone')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteMilestone'), $langs->trans('ConfirmDeleteMilestone'), 'confirm_deletemilestone','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($_GET["action"] == 'clone')
|
||||
if ($action == 'clone')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion=array(
|
||||
@ -1512,9 +1500,20 @@ else
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (empty($formconfirm) && ! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $module)
|
||||
{
|
||||
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
|
||||
}
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
/*
|
||||
* Commande
|
||||
|
||||
@ -1875,21 +1875,21 @@ else
|
||||
$head = facture_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
||||
|
||||
$formconfirm='';
|
||||
|
||||
// Confirmation de la conversion de l'avoir en reduc
|
||||
if ($action == 'converttoreduc')
|
||||
{
|
||||
$text=$langs->trans('ConfirmConvertToReduc');
|
||||
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc','',"yes",2);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc','',"yes",2);
|
||||
}
|
||||
|
||||
// Confirmation to delete invoice
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$text=$langs->trans('ConfirmDeleteBill');
|
||||
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete','',0,1);
|
||||
}
|
||||
|
||||
// Confirmation de la validation
|
||||
@ -1922,15 +1922,13 @@ else
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_FAC',$object->socid);
|
||||
}
|
||||
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ValidateBill'),$text,'confirm_valid','',"yes",($conf->notification->enabled?0:2));
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ValidateBill'),$text,'confirm_valid','',"yes",($conf->notification->enabled?0:2));
|
||||
}
|
||||
|
||||
// Confirmation du classement paye
|
||||
if ($action == 'paid' && $resteapayer <= 0)
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidBill',$object->ref),'confirm_paid','',"yes",1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidBill',$object->ref),'confirm_paid','',"yes",1);
|
||||
}
|
||||
if ($action == 'paid' && $resteapayer > 0)
|
||||
{
|
||||
@ -1959,8 +1957,7 @@ else
|
||||
array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100')
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidPartially',$object->ref),'confirm_paid_partially',$formquestion,"yes");
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidPartially',$object->ref),'confirm_paid_partially',$formquestion,"yes");
|
||||
}
|
||||
|
||||
// Confirmation du classement abandonne
|
||||
@ -2000,29 +1997,18 @@ else
|
||||
array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100')
|
||||
);
|
||||
|
||||
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$object->ref),'confirm_canceled',$formquestion,"yes");
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$object->ref),'confirm_canceled',$formquestion,"yes");
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation de la suppression d'une ligne produit
|
||||
if ($action == 'ask_deleteline')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO ajout temporaire pour test en attendant la migration en template
|
||||
*/
|
||||
if ($action == 'ask_deletemilestone')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteMilestone'), $langs->trans('ConfirmDeleteMilestone'), 'confirm_deletemilestone','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($_GET["action"] == 'clone')
|
||||
if ($action == 'clone')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion=array(
|
||||
@ -2030,9 +2016,20 @@ else
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (empty($formconfirm) && ! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $module)
|
||||
{
|
||||
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
|
||||
}
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
// Invoice content
|
||||
|
||||
Loading…
Reference in New Issue
Block a user