From 2d7d346df71959b81a90efcd0fac3023a3a2d767 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 31 Jan 2008 17:04:00 +0000 Subject: [PATCH] =?UTF-8?q?D=E9but=20modification=20expedition=20livraison?= =?UTF-8?q?=20Phase2:=20modification=20des=20livraisons=20-=20elles=20pour?= =?UTF-8?q?ront=20d=E9sormais=20etre=20li=E9=20=E0=20une=20propale=20(pas?= =?UTF-8?q?=20encore=20effectif)=20-=20on=20pourra=20faire=20un=20bon=20de?= =?UTF-8?q?=20livraison=20sans=20document=20de=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/expedition/expedition.class.php | 3 ++- htdocs/expedition/fiche.php | 16 ++++++------- htdocs/livraison/fiche.php | 31 +++++++++++++++++++------- htdocs/livraison/livraison.class.php | 14 +++++++----- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index 4e33bd05af7..65aac8dbf39 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -592,8 +592,9 @@ class Expedition extends CommonObject * Lit le document associé * */ - function fetch_object($object) + function fetch_object() { + $object = $this->origin; $class = ucfirst($object); $this->$object = & new $class($this->db); $this->$object->fetch($this->origin_id); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 0b38593e79a..5b50e5bdfe0 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -194,7 +194,7 @@ if ($_GET["action"] == 'create') print $mesg.'
'; } - $class = ucfirst($origin); + $class = ucfirst($origin); $object = new $class($db); $object->loadExpeditions(); @@ -439,8 +439,8 @@ else if ($expedition->id > 0) { - $object = New Commande($db); - $object->fetch($expedition->origin_id); + $object = $expedition->origin; + $expedition->fetch_object(); $soc = new Societe($db); $soc->fetch($expedition->socid); @@ -466,7 +466,7 @@ else */ if ($_GET["action"] == 'delete') { - $html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("DeleteSending"),"Etes-vous sûr de vouloir supprimer cette expedition ?","confirm_delete"); + $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('DeleteSending'),'Etes-vous sûr de vouloir supprimer cette expedition ?','confirm_delete'); print '
'; } @@ -476,7 +476,7 @@ else */ if ($_GET["action"] == 'valid') { - $html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("ValidateSending"),"Etes-vous sûr de vouloir valider cette expédition ?","confirm_valid"); + $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),'Etes-vous sûr de vouloir valider cette expédition ?','confirm_valid'); print '
'; } /* @@ -485,7 +485,7 @@ else */ if ($_GET["action"] == 'annuler') { - $html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("CancelSending"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel"); + $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('CancelSending'),'Etes-vous sûr de vouloir annuler cette commande ?','confirm_cancel'); print '
'; } @@ -517,12 +517,12 @@ else if ($conf->commande->enabled) { print $langs->trans("RefOrder").''; - print ''.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref; + print ''.img_object($langs->trans("ShowOrder"),'order').' '.$expedition->$object->ref; } else { print $langs->trans("RefProposal").''; - print ''.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref; + print ''.img_object($langs->trans("ShowProposal"),'propal').' '.$expedition->$object->ref; } print "\n"; print ''; diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 5f0172e9b3d..5544217ea20 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -361,7 +361,13 @@ else { $livraison = new Livraison($db); $result = $livraison->fetch($_GET["id"]); - + + if ($livraison->origin_id) + { + $object = $livraison->origin; + $livraison->fetch_object(); + } + if ( $livraison->id > 0) { $soc = new Societe($db); @@ -389,7 +395,7 @@ else if ($_GET["action"] == 'delete') { $expedition_id = $_GET["expid"]; - $html->form_confirm("fiche.php?id=$livraison->id&expid=$expedition_id","Supprimer le bon de livraison","Etes-vous sûr de vouloir supprimer ce bon de livraison ?","confirm_delete"); + $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,'Supprimer le bon de livraison','Etes-vous sûr de vouloir supprimer ce bon de livraison ?','confirm_delete'); print '
'; } @@ -399,7 +405,7 @@ else */ if ($_GET["action"] == 'valid') { - $html->form_confirm("fiche.php?id=$livraison->id","Valider le bon de livraison","Etes-vous sûr de vouloir valider ce bon de livraison ?","confirm_valid"); + $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,'Valider le bon de livraison','Etes-vous sûr de vouloir valider ce bon de livraison ?','confirm_valid'); print '
'; } @@ -419,12 +425,21 @@ else print ""; // Document origine - print ''.$langs->trans("RefOrder").''; - print ''.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref."\n"; - print ''; + if ($conf->commande->enabled) + { + print ''.$langs->trans("RefOrder").''; + print ''.img_object($langs->trans("ShowOrder"),'order').' '.$livraison->$object->ref."\n"; + print ''; + } + else + { + print ''.$langs->trans("RefProposal").''; + print ''.img_object($langs->trans("ShowProposal"),'propal').' '.$livraison->$object->ref."\n"; + print ''; + } - // Commande liée - print ''.$langs->trans("RefCustomerOrderShort").''; + // Ref client + print ''.$langs->trans("RefCustomer").''; print ''.$livraison->ref_client."\n"; print ''; diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php index d8016b91347..c624f67431b 100644 --- a/htdocs/livraison/livraison.class.php +++ b/htdocs/livraison/livraison.class.php @@ -31,6 +31,8 @@ require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php"); +if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); /** @@ -583,15 +585,17 @@ class Livraison extends CommonObject } } - + /* - * Lit la commande associée + * Lit le document associé * */ - function fetch_commande() + function fetch_object() { - $this->commande =& new Commande($this->db); - $this->commande->fetch($this->commande_id); + $object = $this->origin; + $class = ucfirst($this->origin); + $this->$object = & new $class($this->db); + $this->$object->fetch($this->origin_id); } /**