From e78facd5da66145adb3422f258dc8b728a9a6c20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Oct 2008 15:16:44 +0000 Subject: [PATCH] Fix: Can not delete a supplier order line --- htdocs/fourn/commande/fiche.php | 15 +++++++++------ htdocs/fourn/fournisseur.commande.class.php | 6 ++++-- htdocs/lib/sendings.lib.php | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index a1952410dbb..428c042a295 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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 '
'; @@ -609,19 +609,20 @@ if ($id > 0) print $commande->getLibStatut(4); print ""; + // Date if ($commande->methode_commande_id > 0) { print ''.$langs->trans("Date").''; if ($commande->date_commande) { - print dolibarr_print_date($commande->date_commande,"dayhour")."\n"; + print dolibarr_print_date($commande->date_commande,"dayhourtext")."\n"; } print ''; if ($commande->methode_commande) { - print $langs->trans("Method")." : " .$commande->methode_commande; + print $langs->trans("Method")." : " .$commande->methode_commande; } print ""; } @@ -746,7 +747,9 @@ if ($id > 0) print img_edit(); print ''; - print 'id.'">'; + $actiondelete='delete_product_line'; + if (empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)) $actiondelete='confirm_deleteproductline'; + print ''; print img_delete(); print ''; } @@ -799,7 +802,7 @@ if ($id > 0) print '' . "\n"; print "\n"; } - $i++; + $i++; } /* diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 951351f1d9a..a4ba6285f7b 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -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 diff --git a/htdocs/lib/sendings.lib.php b/htdocs/lib/sendings.lib.php index 51cab637d63..4681bc90cc3 100644 --- a/htdocs/lib/sendings.lib.php +++ b/htdocs/lib/sendings.lib.php @@ -112,7 +112,7 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='') { if ($objp->livraison_id) { - print ''.img_object($langs->trans("ShowSending"),'generic').' '.$objp->livraison_ref.''; + print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->livraison_ref.''; print ''.$objp->qty_received.''; print ''.dolibarr_print_date($objp->date_delivery,'dayhour').''; }