From 5735736a3beb328c0dd139381b4289833ab19d7f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 8 Jul 2009 11:31:59 +0000 Subject: [PATCH] Fix: the delivery address was not recovered --- htdocs/comm/addpropal.php | 10 +++--- htdocs/comm/adresse_livraison.class.php | 26 +++++++-------- htdocs/comm/adresse_livraison.php | 11 +++++-- htdocs/commande/fiche.php | 43 ++++++++++++------------- htdocs/expedition/commande.php | 43 ++++++++++++------------- htdocs/expedition/fiche.php | 24 ++++++++++++++ 6 files changed, 91 insertions(+), 66 deletions(-) diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 538e6b97781..3d68ed36893 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -143,17 +143,17 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("ValidityDuration").' '.$langs->trans("days").''; - // Conditions de r�glement + // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; $html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id'); print ''; - // Mode de reglement + // Mode of payment print ''.$langs->trans('PaymentMode').''; $html->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); print ''; - // Date de livraison (ou de fabrication) + // Delivery date (or manufacturing) print ''.$langs->trans("DeliveryDate").''; print ''; if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") @@ -171,7 +171,7 @@ if ($_GET["action"] == 'create') } print ''; - // Adresse de livraison + // Delivery address if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) { print ''.$langs->trans('DeliveryAddress').''; @@ -193,7 +193,7 @@ if ($_GET["action"] == 'create') $html->select_array('model',$liste,$conf->global->PROPALE_ADDON_PDF); print ""; - // Projet + // Project if ($conf->projet->enabled) { print ''; diff --git a/htdocs/comm/adresse_livraison.class.php b/htdocs/comm/adresse_livraison.class.php index 7fab53b9354..f7cb04debff 100644 --- a/htdocs/comm/adresse_livraison.class.php +++ b/htdocs/comm/adresse_livraison.class.php @@ -54,7 +54,7 @@ class AdresseLivraison /** * \brief Constructeur de la classe - * \param DB handler accès base de données + * \param DB handler acc�s base de donn�es * \param id id societe (0 par defaut) */ function AdresseLivraison($DB, $id=0) @@ -69,8 +69,8 @@ class AdresseLivraison } /** - * \brief Crée l'adresse de livraison de la société en base - * \param user Objet utilisateur qui demande la création + * \brief Cr�e l'adresse de livraison de la soci�t� en base + * \param user Objet utilisateur qui demande la cr�ation * \return int 0 si ok, < 0 si erreur */ @@ -78,7 +78,7 @@ class AdresseLivraison { global $langs,$conf; - // Nettoyage paramètres + // Nettoyage param�tres $this->nom=trim($this->nom); $this->label=trim($this->label); @@ -150,7 +150,7 @@ class AdresseLivraison $result = 0; if (!$this->nom || !$this->label) { - $this->error = "Le nom de la société et le label ne peut être vide.\n"; + $this->error = "The name of company and the label can not be empty.\n"; $result = -2; } return $result; @@ -158,9 +158,9 @@ class AdresseLivraison /** - * \brief Mise a jour des paramètres de l'adresse de livraison + * \brief Mise a jour des parametres de l'adresse de livraison * \param id id adresse de livraison - * \param user Utilisateur qui demande la mise à jour + * \param user Utilisateur qui demande la mise a jour * \return int <0 si ko, >=0 si ok */ function update($idl, $socid, $user='') @@ -169,7 +169,7 @@ class AdresseLivraison dol_syslog("Societe::Update"); - // Nettoyage des paramètres + // Nettoyage des param�tres $this->fk_societe = $socid; $this->label = trim($this->label); @@ -243,8 +243,8 @@ class AdresseLivraison } /** - * \brief Charge depuis la base toutes les adresses de livraison d'une société - * \param socid Id de la société à charger en mémoire + * \brief Charge depuis la base toutes les adresses de livraison d'une societe + * \param socid Id de la societe a charger en memoire * \param user Objet de l'utilisateur * \return int >0 si ok, <0 si ko */ @@ -274,7 +274,7 @@ class AdresseLivraison $this->lignes = array(); $this->db->free($resqlsoc); - // Adresses de livraison liées à la société + // Adresses de livraison liees a la societe if ($this->socid) { $sql = 'SELECT a.rowid as idl, a.label, a.nom, a.address,'.$this->db->pdate('a.datec').' as dc'; @@ -339,7 +339,7 @@ class AdresseLivraison /** * \brief Charge depuis la base l'objet adresse de livraison - * \param socid Id de l'adresse de livraison à charger en mémoire + * \param socid Id de l'adresse de livraison a charger en memoire * \param user Objet de l'utilisateur * \return int >0 si ok, <0 si ko */ @@ -408,7 +408,7 @@ class AdresseLivraison /** * \brief Suppression d'une adresse de livraison - * \param id id de la societe à supprimer + * \param id id de la societe a supprimer */ function delete($idl,$socid) { diff --git a/htdocs/comm/adresse_livraison.php b/htdocs/comm/adresse_livraison.php index 3c59386289a..c66184096ee 100644 --- a/htdocs/comm/adresse_livraison.php +++ b/htdocs/comm/adresse_livraison.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,6 +112,11 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') Header("Location: ../comm/propal.php?propalid=".$originid); exit; } + elseif ($origin == shipment) + { + Header("Location: ../expedition/fiche.php?id=".$originid); + exit; + } else { Header("Location: adresse_livraison.php?socid=".$socid); @@ -161,7 +166,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') if ($user->rights->societe->creer) { /* - * Fiche adresse de livraison en mode cr�ation + * Fiche adresse de livraison en mode creation */ $livraison = new AdresseLivraison($db); @@ -364,7 +369,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') else { /* - * Fiche soci�t� en mode visu + * Fiche societe en mode visu */ $livraison = new AdresseLivraison($db); $result=$livraison->fetch($socid); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 53be4783bcc..4361db5600c 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1394,30 +1394,27 @@ else print ''; print ''; - if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) + // Delivery address + print ''; + print ''; + + if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryAddress'); + print 'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; + print ''; + + if ($_GET['action'] == 'editdelivery_adress') { - // Adresse de livraison - print ''; - print ''; - - if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; - print ''; - - if ($_GET['action'] == 'editdelivery_adress') - { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); - } - else - { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); - } - print ''; + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); } + else + { + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); + } + print ''; - // Conditions et modes de reglement + // Terms of payment print ''; print ''; - // Payment mode + // Mode of payment print '
'; print $langs->trans('PaymentConditionsShort'); @@ -1438,7 +1435,7 @@ else print '
'; print ''; - // Projet + // Project if ($conf->projet->enabled) { $langs->load('projects'); diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index e2d4be6ed11..3a4cd7167fe 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -268,30 +268,27 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) + // Delivery address + print ''; + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); } + else + { + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); + } + print ''; - // Conditions et modes de r�glement + // Terms of payment print '
'; print $langs->trans('PaymentMode'); @@ -1456,7 +1453,7 @@ else } print '
'; + print ''; + + if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryAddress'); + print 'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; + print '
'; + + if ($_GET['action'] == 'editdelivery_adress') { - // Adresse de livraison - print '
'; - print ''; - - if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; - print '
'; - - if ($_GET['action'] == 'editdelivery_adress') - { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); - } - else - { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); - } - print '
'; print ''; + + // Mode of payment print '
'; print $langs->trans('PaymentConditionsShort'); @@ -309,6 +306,8 @@ if ($id > 0 || ! empty($ref)) $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none'); } print '
'; print ''; - // Projet + // Project if ($conf->projet->enabled) { $langs->load('projects'); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 3e594894606..7567f2f34b5 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -282,6 +282,18 @@ if ($_GET["action"] == 'create') // Date print ""; print '\n"; + + // Delivery address + print ''; + print ''."\n"; // Warehouse (id forced) if ($conf->stock->enabled && $_GET["entrepot_id"]) @@ -637,6 +649,18 @@ else print ''; print '\n"; print ''; + + // Delivery address + print ''; + print ''."\n"; // Weight print '';
'; print $langs->trans('PaymentMode'); @@ -326,7 +325,7 @@ if ($id > 0 || ! empty($ref)) } print '
".$langs->trans("Date")."'.dol_print_date($object->date,"day")."
'.$langs->trans('DeliveryAddress').''; + if (!empty($object->fk_delivery_address)) + { + require_once(DOL_DOCUMENT_ROOT ."/comm/adresse_livraison.class.php"); + $deliveryAddress=new AdresseLivraison($db); + $deliveryAddress->fetch_adresse($object->fk_delivery_address); + print ''.$deliveryAddress->label.''; + } + print '
'.$langs->trans("Date").''.dol_print_date($expedition->date,"daytext")."
'.$langs->trans('DeliveryAddress').''; + if (!empty($expedition->fk_delivery_address)) + { + require_once(DOL_DOCUMENT_ROOT ."/comm/adresse_livraison.class.php"); + $deliveryAddress=new AdresseLivraison($db); + $deliveryAddress->fetch_adresse($expedition->fk_delivery_address); + print 'id.'>'.$deliveryAddress->label.''; + } + print '
'.$langs->trans("TotalWeight").'