nettoyage du code
This commit is contained in:
parent
a35d706365
commit
2537cef00d
@ -81,6 +81,7 @@ $form=new Form($db);
|
|||||||
/* Actions */
|
/* Actions */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
// Suppression de la propale
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
if ($user->rights->propale->supprimer)
|
if ($user->rights->propale->supprimer)
|
||||||
@ -96,31 +97,16 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Supprime une ligne produit SANS confirmation
|
* Supprime une ligne produit AVEC OU SANS confirmation
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'deleteline' && $user->rights->propale->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
{
|
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
||||||
$propal = new Propal($db);
|
|
||||||
$propal->fetch($_GET['propalid']);
|
|
||||||
$propal->delete_product($_GET['ligne']);
|
|
||||||
if ($_REQUEST['lang_id'])
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Supprime une ligne produit AVEC confirmation
|
|
||||||
*/
|
|
||||||
if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
|
||||||
{
|
{
|
||||||
if ($user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->fetch($_GET['propalid']);
|
$propal->fetch($_GET['propalid']);
|
||||||
$result=$propal->delete_product($_GET['ligne']);
|
$result = $propal->delete_product($_GET['ligne']);
|
||||||
if ($_REQUEST['lang_id'])
|
if ($_REQUEST['lang_id'])
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||||
@ -132,6 +118,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validation de la propale
|
||||||
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
|
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
if ($user->rights->propale->valider)
|
if ($user->rights->propale->valider)
|
||||||
|
|||||||
@ -77,9 +77,44 @@ if ($_GET["projetid"])
|
|||||||
$projetid = $_GET["projetid"];
|
$projetid = $_GET["projetid"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Actions */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
// Suppression de la commande
|
||||||
|
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||||
|
{
|
||||||
|
if ($user->rights->commande->supprimer )
|
||||||
|
{
|
||||||
|
$commande = new Commande($db);
|
||||||
|
$commande->fetch($_GET['id']);
|
||||||
|
$commande->delete();
|
||||||
|
Header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Supprime une ligne produit AVEC ou SANS confirmation
|
||||||
*/
|
*/
|
||||||
|
if (($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
|
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
||||||
|
{
|
||||||
|
if ($user->rights->commande->creer)
|
||||||
|
{
|
||||||
|
$commande = new Commande($db);
|
||||||
|
$commande->fetch($_GET['id']);
|
||||||
|
$result = $commande->delete_line($_GET['lineid']);
|
||||||
|
if ($_REQUEST['lang_id'])
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
commande_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
|
||||||
|
}
|
||||||
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Categorisation dans projet
|
// Categorisation dans projet
|
||||||
if ($_POST['action'] == 'classin' && $user->rights->commande->creer)
|
if ($_POST['action'] == 'classin' && $user->rights->commande->creer)
|
||||||
@ -378,21 +413,6 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['action'] == 'deleteline' && $user->rights->commande->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
|
||||||
{
|
|
||||||
$commande = new Commande($db);
|
|
||||||
$commande->fetch($_GET['id']);
|
|
||||||
$result = $commande->delete_line($_GET['lineid']);
|
|
||||||
if ($_REQUEST['lang_id'])
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
commande_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
|
|
||||||
Header('Location: fiche.php?id='.$_GET['id']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->rights->commande->valider)
|
if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->rights->commande->valider)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
@ -416,18 +436,6 @@ if ($_POST['action'] == 'confirm_cancel' && $_POST['confirm'] == 'yes' && $user-
|
|||||||
$result = $commande->cancel($user);
|
$result = $commande->cancel($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
|
||||||
{
|
|
||||||
if ($user->rights->commande->supprimer )
|
|
||||||
{
|
|
||||||
$commande = new Commande($db);
|
|
||||||
$commande->fetch($_GET['id']);
|
|
||||||
$commande->delete();
|
|
||||||
Header('Location: index.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
{
|
{
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
|
|||||||
@ -76,10 +76,58 @@ if ($_GET["projetid"])
|
|||||||
$NBLINES=4;
|
$NBLINES=4;
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Actions */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
// Suppression de la facture
|
||||||
|
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||||
|
{
|
||||||
|
if ($user->rights->facture->supprimer)
|
||||||
|
{
|
||||||
|
$fac = new Facture($db);
|
||||||
|
$result = $fac->fetch($_GET['facid']);
|
||||||
|
$result = $fac->delete();
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
Header('Location: '.$_SERVER["PHP_SELF"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Supprime une ligne produit AVEC ou SANS confirmation
|
||||||
*/
|
*/
|
||||||
|
if (($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
|
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
||||||
|
{
|
||||||
|
if ($user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
$fac = new Facture($db);
|
||||||
|
$fac->fetch($_GET['facid']);
|
||||||
|
$result = $fac->deleteline($_GET['rowid'], $user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
if ($_REQUEST['lang_id'])
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $fac->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET['facid']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
if ($_GET['action'] == 'valid')
|
if ($_GET['action'] == 'valid')
|
||||||
@ -236,24 +284,6 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
|
||||||
{
|
|
||||||
if ($user->rights->facture->creer)
|
|
||||||
{
|
|
||||||
$fac = new Facture($db);
|
|
||||||
$fac->fetch($_GET['facid']);
|
|
||||||
$fac->deleteline($_GET['rowid'], $user);
|
|
||||||
if ($_REQUEST['lang_id'])
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
|
|
||||||
}
|
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET['facid']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Classe à "payée"
|
// Classe à "payée"
|
||||||
if ($_POST['action'] == 'confirm_payed' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
|
if ($_POST['action'] == 'confirm_payed' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
|
||||||
{
|
{
|
||||||
@ -293,25 +323,6 @@ if ($_POST['action'] == 'confirm_canceled' && $_POST['confirm'] == 'yes')
|
|||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Supprimer
|
|
||||||
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
|
||||||
{
|
|
||||||
if ($user->rights->facture->supprimer)
|
|
||||||
{
|
|
||||||
$fac = new Facture($db);
|
|
||||||
$result = $fac->fetch($_GET['facid']);
|
|
||||||
$result = $fac->delete();
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$fac->error.'</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convertir en reduc
|
// Convertir en reduc
|
||||||
if ($_POST['action'] == 'confirm_converttoreduc' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer)
|
if ($_POST['action'] == 'confirm_converttoreduc' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer)
|
||||||
@ -854,27 +865,6 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['action'] == 'deleteline' && $user->rights->facture->creer && ! $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
|
||||||
{
|
|
||||||
$fac = new Facture($db,'',$_GET['facid']);
|
|
||||||
$fac->fetch($_GET['facid']);
|
|
||||||
$result = $fac->deleteline($_GET['rowid'], $user);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
if ($_REQUEST['lang_id'])
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
// facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $fac->error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ordonnancement des lignes
|
* Ordonnancement des lignes
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user