From 05ceecd184a7239f655300e2cbaba9b1c44f2c3f Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Tue, 4 Feb 2014 16:55:09 +0100 Subject: [PATCH 1/3] add hook printObjectLine on product supplier prices list --- htdocs/product/fournisseurs.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index cd5f69ba95d..21d8fdedb3b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -517,6 +517,12 @@ if ($id || $ref) print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):" "); print ''; } + + if (is_object($hookmanager)) + { + $parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$product->id); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action); + } // Modify-Remove print ''; From efa7a16c077281d0b1b50d7446666fd50fee679e Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Tue, 4 Feb 2014 17:30:48 +0100 Subject: [PATCH 2/3] Add hook printObjectLine supplier order and supplier invoice --- htdocs/fourn/commande/fiche.php | 9 ++++++++- htdocs/fourn/facture/fiche.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 214fc41770b..ffa72ecf9ac 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1583,7 +1583,7 @@ elseif (! empty($object->id)) // Edit line if ($action != 'edit_line' || $_GET['rowid'] != $line->id) { - print ''; + print ''; // Show product and description print ''; @@ -1634,6 +1634,13 @@ elseif (! empty($object->id)) } print ''.price($line->total_ht).''; + + if (is_object($hookmanager)) + { + $parameters=array('line'=>$line,'num'=>$num,'i'=>$i); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action); + } + if ($object->statut == 0 && $user->rights->fournisseur->commande->creer) { print 'id.'#'.$line->id.'">'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 073ea94b40e..3722ceaac51 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1941,7 +1941,7 @@ else } else // Affichage simple de la ligne { - print ''; + print ''; // Show product and description print ''; @@ -1996,7 +1996,13 @@ else print ''.price($object->lines[$i]->total_ht).''; print ''.price($object->lines[$i]->total_ttc).''; - + + if (is_object($hookmanager)) + { + $parameters=array('line'=>$object->lines[$i],'num'=>$num,'i'=>$i); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action); + } + print ''; if ($object->statut == 0) print 'lines[$i]->rowid.'">'.img_edit().''; else print ' '; From 676101b02f2d1c107215dee860af974f2d785e33 Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Tue, 4 Feb 2014 17:35:27 +0100 Subject: [PATCH 3/3] Add trigger on deleteline for supplier order and move trigger on deleteline for supplier invoice after delete sql query --- .../class/fournisseur.commande.class.php | 10 ++++++++ .../fourn/class/fournisseur.facture.class.php | 25 ++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6a3d7918ac3..8fe381d35c0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1408,6 +1408,16 @@ class CommandeFournisseur extends CommonOrder dol_syslog(get_class($this)."::deleteline sql=".$sql); if ($resql) { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $result = 0; + $interface=new Interfaces($this->db); + $result = $interface->run_triggers('LINEORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + $result=$this->update_price(); return 0; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 060d2d51a83..42f3f3cf7e0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1259,18 +1259,6 @@ class FactureFournisseur extends CommonInvoice $error=0; $this->db->begin(); - if (! $error && ! $notrigger) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - } - if (! $error) { // Supprime ligne @@ -1285,6 +1273,19 @@ class FactureFournisseur extends CommonInvoice dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); } } + + if (! $error && ! $notrigger) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } + if (! $error) {