From 90cdf27007ba032dae2fbee228ce66f7dbcbf2a3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 14 Mar 2012 16:26:22 +0100 Subject: [PATCH] Fix: move delivery address in contact tab --- htdocs/commande/contact.php | 2 +- htdocs/expedition/contact.php | 31 ++++++++++++- htdocs/expedition/fiche.php | 85 +++++++++-------------------------- 3 files changed, 51 insertions(+), 67 deletions(-) diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index e455e6ce54c..4cc027acf0b 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -173,7 +173,7 @@ if ($id > 0 || ! empty($ref)) print ''.$object->client->getNomUrl(1).''; // Delivery address - if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS) + if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) { print ''; print ''; print ''; + + // Delivery address + if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) + { + print ''; + } print "
'; diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index ce2a3864400..2637115a697 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -42,7 +42,7 @@ $action=GETPOST('action','alpha'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expedition', $id,''); -$object = new expedition($db); +$object = new Expedition($db); if ($id > 0 || ! empty($ref)) { $object->fetch($id, $ref); @@ -119,6 +119,12 @@ else if ($action == 'deleteline' && $user->rights->expedition->creer) } } +else if ($action == 'setaddress' && $user->rights->expedition->creer) +{ + $object->fetch($id); + $result=$object->setDeliveryAddress($_POST['fk_address']); + if ($result < 0) dol_print_error($db,$object->error); +} /* @@ -203,6 +209,29 @@ if ($id > 0 || ! empty($ref)) print $objectsrc->ref_client; print '
'; + print ''; + + if ($action != 'editdelivery_address' && $object->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryAddress'); + print 'socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'
'; + print '
'; + + if ($action == 'editdelivery_address') + { + $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','shipping',$object->id); + } + else + { + $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','shipping',$object->id); + } + print '
"; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f5e62b60043..6f6069c8767 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1,32 +1,31 @@ * Copyright (C) 2005-2010 Laurent Destailleur -* Copyright (C) 2005 Simon TOSSER -* Copyright (C) 2005-2012 Regis Houssin -* Copyright (C) 2011-2012 Juanjo Menent -* -* 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 -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/expedition/fiche.php -* \ingroup expedition -* \brief Fiche descriptive d'une expedition -*/ + * \ingroup expedition + * \brief Fiche descriptive d'une expedition + */ require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); @@ -511,13 +510,6 @@ else if ($action == 'classifybilled') $object->set_billed(); } -else if ($action == 'setaddress' && $user->rights->expedition->creer) -{ - $object->fetch($id); - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -} - /* * View @@ -526,7 +518,6 @@ else if ($action == 'setaddress' && $user->rights->expedition->creer) llxHeader('',$langs->trans('Sending'),'Expedition'); $form = new Form($db); -$formother = new FormOther($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); @@ -617,19 +608,6 @@ if ($action == 'create') print "\n"; print ''; - // Delivery address - if (($origin == 'commande' && $conf->global->COMMANDE_ADD_DELIVERY_ADDRESS) - || ($origin == 'propal' && $conf->global->PROPAL_ADD_DELIVERY_ADDRESS)) - { - print ''.$langs->trans('DeliveryAddress').''; - print ''; - if (!empty($object->fk_delivery_address)) - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','commande',$object->id); - } - print ''."\n"; - } - // Note if ($object->note && ! $user->societe_id) { @@ -1043,29 +1021,6 @@ else print ''; print ''; - // Delivery address - if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS || $conf->global->PROPAL_ADD_DELIVERY_ADDRESS) - { - print ''; - print ''; - - if ($action != 'editdelivery_address' && $object->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'
'; - print ''; - - if ($action == 'editdelivery_address') - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','shipment',$object->id); - } - else - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','shipment',$object->id); - } - print ''; - } - // Weight print ''.$form->editfieldkey("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer).''; print $form->editfieldval("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer);