Implémentation de la validation
This commit is contained in:
parent
644d1ee89e
commit
0fb65739c8
@ -45,6 +45,17 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user-
|
|||||||
Header("Location: liste.php");
|
Header("Location: liste.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'confirm_valide' && $_POST["confirm"] == 'yes' && $user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
$paiement = new Paiement($db);
|
||||||
|
$paiement->id = $_GET["id"];
|
||||||
|
if ( $paiement->valide() == 0 )
|
||||||
|
{
|
||||||
|
Header("Location: fiche.php?id=".$paiement->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -68,13 +79,23 @@ $paiement->fetch($_GET["id"]);
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression de la facture
|
* Confirmation de la suppression du paiement
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'delete')
|
if ($_GET["action"] == 'delete')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
$html->form_confirm("fiche.php?id=$paiement->id","Supprimer le paiement","Etes-vous sûr de vouloir supprimer ce paiement ?","confirm_delete");
|
$html->form_confirm("fiche.php?id=$paiement->id","Supprimer le paiement","Etes-vous sûr de vouloir supprimer ce paiement ?","confirm_delete");
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'valide')
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
$html->form_confirm("fiche.php?id=$paiement->id","Valider le paiement","Etes-vous sûr de vouloir valider ce paiment, auncune modification n'est possible une fois le paiement validé ?","confirm_valide");
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,20 +178,22 @@ if ($db->query($sql))
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print "<br></div>";
|
print "<br></div>";
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->societe_id == 0 && $allow_delete)
|
if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET["action"] == '')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<a class="tabAction" href="fiche.php?id='.$_GET["id"].'&action=valide">'.$langs->trans("Valider").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($_GET["action"] != 'delete') {
|
|
||||||
print '<a class="tabAction" href="fiche.php?id='.$_GET["id"].'&action=delete">'.$langs->trans("Delete").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</div>";
|
if ($user->societe_id == 0 && $allow_delete && $paiement->statut == 0 && $_GET["action"] == '')
|
||||||
}
|
{
|
||||||
|
print '<a class="butDelete" href="fiche.php?id='.$_GET["id"].'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
|
|
||||||
$db->close();
|
}
|
||||||
|
print "</div>";
|
||||||
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -62,13 +62,13 @@ class Paiement
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Recupére l'objet paiement
|
* \brief Récupère l'objet paiement
|
||||||
* \param id id du paiement a récupérer
|
* \param id id du paiement a récupérer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function fetch($id)
|
function fetch($id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid,".$this->db->pdate("p.datep")." as dp, p.amount";
|
$sql = "SELECT p.rowid,".$this->db->pdate("p.datep")." as dp, p.amount, p.statut";
|
||||||
$sql .=", c.libelle as paiement_type, p.num_paiement";
|
$sql .=", c.libelle as paiement_type, p.num_paiement";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c";
|
||||||
$sql .= " WHERE p.fk_paiement = c.id";
|
$sql .= " WHERE p.fk_paiement = c.id";
|
||||||
@ -87,6 +87,7 @@ class Paiement
|
|||||||
$this->montant = $obj->amount;
|
$this->montant = $obj->amount;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->type_libelle = $obj->paiement_type;
|
$this->type_libelle = $obj->paiement_type;
|
||||||
|
$this->statut = $obj->statut;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -210,7 +211,7 @@ class Paiement
|
|||||||
$form->select($name, $sql, $id);
|
$form->select($name, $sql, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -257,6 +258,24 @@ class Paiement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Valide la paiement
|
||||||
|
*/
|
||||||
|
function valide()
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."paiement SET statut = 1 WHERE rowid = ".$this->id;
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Paiement::Valide Error -1");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Information sur l'objet
|
* \brief Information sur l'objet
|
||||||
* \param id id du paiement dont il faut afficher les infos
|
* \param id id du paiement dont il faut afficher les infos
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user