From f213b4f555a6719efdc7cab9743d56460c6b2836 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 13 Mar 2010 17:44:27 +0000 Subject: [PATCH] Fix: best autonomy of modules Fix: uniformise fields and code !! not stable !! --- htdocs/commande/commande.class.php | 2 +- htdocs/expedition/expedition.class.php | 2 +- htdocs/expedition/fiche.php | 40 +++++++++++++++----------- htdocs/expedition/shipment.php | 22 +++++++------- htdocs/lib/sendings.lib.php | 4 +-- 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index c197c78ce87..eb0659cef42 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index da61c6f3b47..5d4cf854d34 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -231,7 +231,7 @@ class Expedition extends CommonObject * \brief Lit une expedition * \param id */ - function fetch ($id) + function fetch($id) { global $conf; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index a3f3fef98ed..bce6266f274 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -52,7 +52,7 @@ $origin_id = isset($_GET["id"])?$_GET["id"]:''; $id = $origin_id; $origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal -$origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal +$origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal // Security check @@ -60,7 +60,6 @@ if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,$origin,$origin_id,''); - /* * Actions */ @@ -72,16 +71,16 @@ if ($_POST["action"] == 'add') // Creation de l'objet expedition $expedition = new Expedition($db); - $expedition->date_expedition = time(); - $expedition->note = $_POST["note"]; - $expedition->origin = $origin; - $expedition->origin_id = $origin_id; - $expedition->weight = $_POST["weight"]==""?"NULL":$_POST["weight"]; - $expedition->sizeH = $_POST["sizeH"]==""?"NULL":$_POST["sizeH"]; - $expedition->sizeW = $_POST["sizeW"]==""?"NULL":$_POST["sizeW"]; - $expedition->sizeS = $_POST["sizeS"]==""?"NULL":$_POST["sizeS"]; - $expedition->size_units = $_POST["size_units"]; - $expedition->weight_units = $_POST["weight_units"]; + $expedition->date_expedition = time(); + $expedition->note = $_POST["note"]; + $expedition->origin = $origin; + $expedition->origin_id = $origin_id; + $expedition->weight = $_POST["weight"]==""?"NULL":$_POST["weight"]; + $expedition->sizeH = $_POST["sizeH"]==""?"NULL":$_POST["sizeH"]; + $expedition->sizeW = $_POST["sizeW"]==""?"NULL":$_POST["sizeW"]; + $expedition->sizeS = $_POST["sizeS"]==""?"NULL":$_POST["sizeS"]; + $expedition->size_units = $_POST["size_units"]; + $expedition->weight_units = $_POST["weight_units"]; // On boucle sur chaque ligne du document d'origine pour completer objet expedition // avec qte a livrer @@ -90,10 +89,12 @@ if ($_POST["action"] == 'add') $object->fetch($expedition->origin_id); //$object->fetch_lines(); - $expedition->socid = $object->socid; - $expedition->fk_delivery_address = $object->fk_delivery_address; - $expedition->expedition_method_id = $_POST["expedition_method_id"]; - $expedition->tracking_number = $_POST["tracking_number"]; + $expedition->socid = $object->socid; + $expedition->ref_customer = $object->ref_client; + $expedition->date_delivery = $object->date_livraison; + $expedition->fk_delivery_address = $object->fk_delivery_address; + $expedition->expedition_method_id = $_POST["expedition_method_id"]; + $expedition->tracking_number = $_POST["tracking_number"]; for ($i = 0 ; $i < sizeof($object->lignes) ; $i++) { @@ -278,7 +279,7 @@ if ($_GET["action"] == 'create') print ''; print ''; print ''; - print ''; + print ''; if ($_GET["entrepot_id"]) { print ''; @@ -314,6 +315,11 @@ if ($_GET["action"] == 'create') // Date print "".$langs->trans("Date").""; print ''.dol_print_date($object->date,"day")."\n"; + + // Date delivery planned + print ''.$langs->trans("DateDeliveryPlanned").''; + print ''.dol_print_date($object->date_livraison,'day')."\n"; + print ''; // Delivery address if (($origin == 'commande' && $conf->global->COMMANDE_ADD_DELIVERY_ADDRESS) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 990961e702e..835af4e636e 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -75,14 +75,14 @@ if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes') } // Positionne ref commande client -if ($_POST['action'] == 'set_ref_client' && $user->rights->commande->creer) +if ($_POST['action'] == 'setrefcustomer' && $user->rights->commande->creer) { $commande = new Commande($db); $commande->fetch($_GET['id']); - $commande->set_ref_client($user, $_POST['ref_client']); + $commande->set_ref_client($user, $_POST['ref_customer']); } -if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer) +if ($_POST['action'] == 'setdatedelivery' && $user->rights->commande->creer) { //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datelivraison=dol_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); @@ -96,11 +96,11 @@ if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer) } } -if ($_POST['action'] == 'setdeliveryadress' && $user->rights->commande->creer) +if ($_POST['action'] == 'setdeliveryaddress' && $user->rights->commande->creer) { $commande = new Commande($db); $commande->fetch($_GET['id']); - $commande->set_adresse_livraison($user,$_POST['adresse_livraison_id']); + $commande->set_adresse_livraison($user,$_POST['delivery_address_id']); } if ($_POST['action'] == 'setmode' && $user->rights->commande->creer) @@ -187,8 +187,8 @@ if ($id > 0 || ! empty($ref)) { print '
'; print ''; - print ''; - print ''; + print ''; + print ''; print ' '; print '
'; } @@ -261,8 +261,8 @@ if ($id > 0 || ! empty($ref)) { print '
'; print ''; - print ''; - $html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison"); + print ''; + $html->select_date($commande->date_livraison,'liv_','','','',"setdatedelivery"); print ''; print '
'; } @@ -290,7 +290,7 @@ if ($id > 0 || ! empty($ref)) if ($_GET['action'] == 'editdelivery_adress') { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'delivery_address_id','commande',$commande->id); } else { @@ -603,7 +603,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - print ''; + print ''; print ''; $entrepot = new Entrepot($db); diff --git a/htdocs/lib/sendings.lib.php b/htdocs/lib/sendings.lib.php index 57e551a0789..c207587132c 100644 --- a/htdocs/lib/sendings.lib.php +++ b/htdocs/lib/sendings.lib.php @@ -221,14 +221,14 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='') print ''; - print ''; + print ''; if ($conf->livraison_bon->enabled) { if ($objp->livraison_id) { print ''; print ''; - print ''; + print ''; } else {
'.$objp->qty_shipped.''.dol_print_date($objp->date_expedition,'dayhour').''.dol_print_date($objp->date_expedition,'day').''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->livraison_ref.''.$objp->qty_received.''.dol_print_date($objp->date_delivery,'dayhour').''.dol_print_date($objp->date_delivery,'day').'