From 19d4147fcd6e266c526b1da3f467d17c8afc9783 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 11 Mar 2012 11:34:20 +0100 Subject: [PATCH 1/5] Fix: missing contacts with order to invoice --- htdocs/commande/class/commande.class.php | 50 +++++++++---------- htdocs/compta/facture/class/facture.class.php | 25 ++++++++++ 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cc00e37ad79..fa035920386 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -700,35 +700,35 @@ class Commande extends CommonObject { $this->ref="(PROV".$this->id.")"; - // Add linked object + // Add linked object and contacts if ($this->origin && $this->origin_id) { $ret = $this->add_object_linked(); if (! $ret) dol_print_error($this->db); - } - - // TODO mutualiser - if ($this->origin == 'propal' && $this->origin_id) - { - // On recupere les differents contact interne et externe - $prop = new Propal($this->db, $this->socid, $this->origin_id); - - // On recupere le commercial suivi propale - $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); - - if ($this->userid) - { - //On passe le commercial suivi propale en commercial suivi commande - $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); - } - - // On recupere le contact client suivi propale - $this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); - - if ($this->contactid) - { - //On passe le contact client suivi propale en contact client suivi commande - $this->add_contact($this->contactid[0], 'CUSTOMER', 'external'); + + // TODO mutualiser + if ($this->origin == 'propal') + { + // On recupere les differents contact interne et externe + $prop = new Propal($this->db, $this->socid, $this->origin_id); + + // On recupere le commercial suivi propale + $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); + + if ($this->userid) + { + //On passe le commercial suivi propale en commercial suivi commande + $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); + } + + // On recupere le contact client suivi propale + $this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); + + if ($this->contactid) + { + //On passe le contact client suivi propale en contact client suivi commande + $this->add_contact($this->contactid[0], 'CUSTOMER', 'external'); + } } } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f96490b1c81..d58515b7db9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -275,6 +275,31 @@ class Facture extends CommonObject dol_print_error($this->db); $error++; } + + // TODO mutualiser + if ($this->origin == 'commande') + { + // On recupere les differents contact interne et externe + $order = new Commande($this->db, $this->socid, $this->origin_id); + + // On recupere le commercial suivi propale + $this->userid = $order->getIdcontact('internal', 'SALESREPFOLL'); + + if ($this->userid) + { + //On passe le commercial suivi commande en commercial suivi paiement + $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); + } + + // On recupere le contact client facturation commande + $this->contactid = $order->getIdcontact('external', 'BILLING'); + + if ($this->contactid) + { + //On passe le contact client facturation commande en contact client facturation + $this->add_contact($this->contactid[0], 'BILLING', 'external'); + } + } } /* From 2909a80ae2386a22743b5f14b4024258aec4a704 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 11 Mar 2012 12:02:22 +0100 Subject: [PATCH 2/5] Fix: missing class inclusion and origin object id --- htdocs/compta/facture.php | 8 ++++++-- htdocs/compta/facture/class/facture.class.php | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4711ecf7c60..fc3fe0db094 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -38,8 +38,12 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php"); -if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); -if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php'); +if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); +if ($conf->projet->enabled) +{ + require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); + require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php'); +} $langs->load('bills'); //print 'ee'.$langs->trans('BillsCustomer');exit; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d58515b7db9..06db0239c72 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -280,7 +280,8 @@ class Facture extends CommonObject if ($this->origin == 'commande') { // On recupere les differents contact interne et externe - $order = new Commande($this->db, $this->socid, $this->origin_id); + $order = new Commande($this->db); + $order->id = $this->origin_id; // On recupere le commercial suivi propale $this->userid = $order->getIdcontact('internal', 'SALESREPFOLL'); From b82add12e01fd1160a9e90b0e026c58ed472721d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 12 Mar 2012 21:30:24 +0100 Subject: [PATCH 3/5] Fix: [ bug #335 ] --- htdocs/includes/modules/mailings/contacts3.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/modules/mailings/contacts3.modules.php b/htdocs/includes/modules/mailings/contacts3.modules.php index 813c8263ce2..a36083f293e 100755 --- a/htdocs/includes/modules/mailings/contacts3.modules.php +++ b/htdocs/includes/modules/mailings/contacts3.modules.php @@ -82,7 +82,7 @@ class mailing_contacts3 extends MailingTargets $sql.= " AND sp.entity = ".$conf->entity; if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid"; if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_societe = sp.fk_soc"; - if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db>escape($filtersarray[0])."'"; + if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.name, sp.firstname"; $resql = $this->db->query($sql); From 4aa3d6befdf2765f853c609bc3f0deebd92a577e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 15 Mar 2012 15:18:44 +0800 Subject: [PATCH 4/5] Fix: missing private and public note --- htdocs/commande/fiche.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index dc737c250d2..ecab4b70747 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1190,6 +1190,9 @@ if ($action == 'create' && $user->rights->commande->creer) $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + + $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); + $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1,'external',1); @@ -1327,8 +1330,8 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''.$langs->trans('NotePublic').''; print ''; - print ''; + print ''; + print ''; // Note privee if (! $user->societe_id) @@ -1336,8 +1339,8 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''.$langs->trans('NotePrivate').''; print ''; - print ''; + print ''; + print ''; } if (is_object($objectsrc)) From 4a041a6b0d7d844db017e48f460d90107912cb91 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 15 Mar 2012 16:22:07 +0800 Subject: [PATCH 5/5] Fix: missing tva rates of supplier --- htdocs/fourn/commande/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index e42fc5ab098..929321aff65 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1194,7 +1194,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - print $html->load_tva('tva_tx',$line->tva_tx); + print $form->load_tva('tva_tx',$line->tva_tx,$soc,$mysoc); print ''; print ''; print '';