Skip to content
Snippets Groups Projects
Commit a8af3d47 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Can remove a supplier order

parent 8d19da30
Branches
Tags
No related merge requests found
......@@ -9,6 +9,7 @@ For users:
- New: Sort list of languages in combo box.
- New: EMails links are show with function dol_print_email
- New: Add graph report on number of entities in product statistics page.
- New: Can delete a supplier order whatever is its status.
- Fix: Failed to go on the future view of bank transaction if there is no
future bank transaction already wrote.
- Fix: Bad ref in supplier list.
......
<?php
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
*
......@@ -904,7 +904,7 @@ if ($id > 0)
/**
* Boutons actions
*/
if ($user->societe_id == 0 && $commande->statut < 3 && $_GET['action'] <> 'editline')
if ($user->societe_id == 0 && $_GET['action'] != 'editline' && $_GET['action'] != 'delete')
{
print '<div class="tabsAction">';
......@@ -953,13 +953,10 @@ if ($id > 0)
}
}
if ($commande->statut == 0)
{
if ($user->rights->fournisseur->commande->creer)
if ($user->rights->fournisseur->commande->annuler)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
}
print "</div>";
}
......
......@@ -975,8 +975,8 @@ class CommandeFournisseur extends Commande
}
/**
* \brief Supprime la commande
*
* \brief Delete an order
* \return int <0 if KO, >0 if OK
*/
function delete()
{
......@@ -987,16 +987,17 @@ class CommandeFournisseur extends Commande
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ;
dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql) )
{
$err++;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id;
$sql.= " AND fk_statut = 0;";
dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG);
if ($resql = $this->db->query($sql) )
{
if ($this->db->affected_rows($resql) <> 1)
if ($this->db->affected_rows($resql) < 1)
{
$err++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment