From c131c3885ad9a342cfac7191702a86701e03031c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Jan 2009 17:11:15 +0000 Subject: [PATCH] Add confirmation on classify payed --- htdocs/fourn/facture/fiche.php | 44 +++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e9d9267696d..bdbd0b49b59 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -113,7 +113,7 @@ if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes } } -if ($_GET['action'] == 'payed') +if ($_REQUEST['action'] == 'confirm_payed' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->facture->creer) { $facturefourn=new FactureFournisseur($db); $facturefourn->fetch($_GET['facid']); @@ -590,6 +590,13 @@ else print '
'; } + // Confirmation de la validation + if ($_GET['action'] == 'payed') + { + $html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed'); + print '
'; + } + /* * Confirmation de la suppression de la facture fournisseur */ @@ -761,7 +768,6 @@ else /* * Lignes - * */ print '
'; print ''; @@ -925,27 +931,37 @@ else print '
'; - if ($fac->statut <= 1 && $fac->getSommePaiement() <= 0 && $user->rights->fournisseur->facture->creer) + if ($_GET['action'] != 'edit' && $fac->statut <= 1 && $fac->getSommePaiement() <= 0 && $user->rights->fournisseur->facture->creer) { - if ($_GET['action'] != 'edit') - { - print ''.$langs->trans('Modify').''; - } + print ''.$langs->trans('Modify').''; } - if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0) + if ($_GET['action'] != 'edit' && $fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('DoPayment').''; } - if ($fac->statut == 1 && price($resteapayer) <= 0 && $fac->paye == 0 && $user->societe_id == 0) + if ($_GET['action'] != 'edit' && $fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0) { - print ''.$langs->trans('ClassifyPayed').''; + print 'use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) + { + $num = $fac->ref; + $url = $_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=confirm_payed&confirm=yes'; + print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmClassifPayed',$num)).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'validate\')"'; + } + else + { + print 'href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=payed"'; + } + print '>'.$langs->trans('ClassifyPayed').''; + + //print ''.$langs->trans('ClassifyPayed').''; } - if ($fac->statut == 0 && $user->rights->fournisseur->facture->valider) + if ($_GET['action'] != 'edit' && $fac->statut == 0 && $user->rights->fournisseur->facture->valider) { - if (sizeof($fac->lignes) && $_GET['action'] <> 'edit') + if (sizeof($fac->lignes)) { print 'use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) @@ -964,12 +980,12 @@ else } } - if ($user->rights->fournisseur->facture->creer) + if ($_GET['action'] != 'edit' && $user->rights->fournisseur->facture->creer) { print ''.$langs->trans('ToClone').''; } - if ($_GET['action'] != 'edit' && $fac->statut == 0 && $user->rights->fournisseur->facture->supprimer) + if ($_GET['action'] != 'edit' && $user->rights->fournisseur->facture->supprimer) { print ''.$langs->trans('Delete').''; }