Impl閙entation 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");
|
||||
}
|
||||
}
|
||||
|
||||
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,15 +79,25 @@ $paiement->fetch($_GET["id"]);
|
||||
$html = new Form($db);
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la facture
|
||||
* Confirmation de la suppression du paiement
|
||||
*
|
||||
*/
|
||||
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");
|
||||
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>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -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)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET["action"] == '')
|
||||
{
|
||||
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>";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
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>';
|
||||
|
||||
}
|
||||
print "</div>";
|
||||
$db->close();
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
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 .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c";
|
||||
$sql .= " WHERE p.fk_paiement = c.id";
|
||||
@ -87,6 +87,7 @@ class Paiement
|
||||
$this->montant = $obj->amount;
|
||||
$this->note = $obj->note;
|
||||
$this->type_libelle = $obj->paiement_type;
|
||||
$this->statut = $obj->statut;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -210,7 +211,7 @@ class Paiement
|
||||
$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
|
||||
* \param id id du paiement dont il faut afficher les infos
|
||||
|
||||
Loading鈥
Reference in New Issue
Block a user