Fix: Can not delete a supplier order line

This commit is contained in:
Laurent Destailleur 2008-10-17 15:16:44 +00:00
parent 7050187012
commit e78facd5da
3 changed files with 14 additions and 9 deletions

View File

@ -224,7 +224,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
exit;
}
if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] == 'yes' || empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)))
{
if ($user->rights->fournisseur->commande->creer)
{
@ -577,7 +577,7 @@ if ($id > 0)
/*
* Confirmation de la suppression d'une ligne produit
*/
if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
if ($_GET['action'] == 'delete_product_line' && ! empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE))
{
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline');
print '<br>';
@ -609,19 +609,20 @@ if ($id > 0)
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dolibarr_print_date($commande->date_commande,"dayhour")."\n";
print dolibarr_print_date($commande->date_commande,"dayhourtext")."\n";
}
print '</td><td width="50%" colspan="3">';
if ($commande->methode_commande)
{
print $langs->trans("Method")." : " .$commande->methode_commande;
print $langs->trans("Method")." : " .$commande->methode_commande;
}
print "</td></tr>";
}
@ -746,7 +747,9 @@ if ($id > 0)
print img_edit();
print '</a></td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;action=delete_product_line&amp;lineid='.$objp->id.'">';
$actiondelete='delete_product_line';
if (empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)) $actiondelete='confirm_deleteproductline';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;action='.$actiondelete.'&amp;lineid='.$objp->id.'">';
print img_delete();
print '</a></td>';
}
@ -799,7 +802,7 @@ if ($id > 0)
print '</tr>' . "\n";
print "</form>\n";
}
$i++;
$i++;
}
/*

View File

@ -47,6 +47,7 @@ class CommandeFournisseur extends Commande
var $id ;
var $brouillon;
/** \brief Constructeur
* \param DB Handler d'accès aux bases de données
*/
@ -123,11 +124,12 @@ class CommandeFournisseur extends Commande
$sql = "SELECT l.rowid, l.ref as ref_fourn, l.fk_product, l.label, l.description, l.qty,";
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
$sql.= " l.total_ht, l.total_tva, l.total_ttc,";
$sql.= " p.rowid as product_id, p.ref, p.label as product, p.description as product_desc";
$sql.= " p.rowid as product_id, p.ref, p.label as product";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= " WHERE l.fk_commande = ".$this->id;
$sql.= " ORDER BY l.rowid";
//print $sql;
dolibarr_syslog("CommandeFournisseur::fetch sql=".$sql,LOG_DEBUG);
$result = $this->db->query($sql);
@ -154,7 +156,7 @@ class CommandeFournisseur extends Commande
$ligne->fk_product = $objp->product_id; // Id du produit
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->product_desc = $objp->description; // Description produit
$ligne->ref = $objp->ref; // Reference
$ligne->ref_fourn = $objp->ref_fourn; // Reference supplier

View File

@ -112,7 +112,7 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
{
if ($objp->livraison_id)
{
print '<td><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'generic').' '.$objp->livraison_ref.'<a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->livraison_ref.'<a></td>';
print '<td align="center">'.$objp->qty_received.'</td>';
print '<td>'.dolibarr_print_date($objp->date_delivery,'dayhour').'</td>';
}