Merge pull request #2930 from atm-ph/fix_issue_2901

Fix issue 2901
This commit is contained in:
Laurent Destailleur 2015-05-31 02:09:40 +02:00
commit 3690274375
3 changed files with 13 additions and 4 deletions

View File

@ -554,7 +554,15 @@ if (! empty($id) && $action != 'edit')
if ($user->rights->don->supprimer) if ($user->rights->don->supprimer)
{ {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>"; if ($don->statut == -1 || $don->statut == 0)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
}
else
{
print '<div class="inline-block divButAction"><a class="butActionDelete butActionRefused" href="#">'.$langs->trans("Delete")."</a></div>";
}
} }
else else
{ {

View File

@ -449,10 +449,11 @@ class Don extends CommonObject
*/ */
function delete($rowid) function delete($rowid)
{ {
global $user;
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0 OR fk_statut = -1";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -190,7 +190,7 @@ if ($resql)
$texte.=' ('.$langs->trans("Stocks").')'; $texte.=' ('.$langs->trans("Stocks").')';
llxHeader("",$title,$helpurl,$texte); llxHeader("",$texte,$helpurl);
if ($sref || $snom || $sall || GETPOST('search')) if ($sref || $snom || $sall || GETPOST('search'))
{ {